Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: [infra-manager] Infrastructure Manager supports the deployment of infrastructure from Terraform configurations in a private Git repository #10561

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static com.google.cloud.config.v1.ConfigClient.ListPreviewsPagedResponse;
import static com.google.cloud.config.v1.ConfigClient.ListResourcesPagedResponse;
import static com.google.cloud.config.v1.ConfigClient.ListRevisionsPagedResponse;
import static com.google.cloud.config.v1.ConfigClient.ListTerraformVersionsPagedResponse;

import com.google.api.core.ApiFunction;
import com.google.api.core.BetaApi;
Expand Down Expand Up @@ -245,6 +246,21 @@ public UnaryCallSettings<DeletePreviewRequest, Operation> deletePreviewSettings(
return ((ConfigStubSettings) getStubSettings()).exportPreviewResultSettings();
}

/** Returns the object with the settings used for calls to listTerraformVersions. */
public PagedCallSettings<
ListTerraformVersionsRequest,
ListTerraformVersionsResponse,
ListTerraformVersionsPagedResponse>
listTerraformVersionsSettings() {
return ((ConfigStubSettings) getStubSettings()).listTerraformVersionsSettings();
}

/** Returns the object with the settings used for calls to getTerraformVersion. */
public UnaryCallSettings<GetTerraformVersionRequest, TerraformVersion>
getTerraformVersionSettings() {
return ((ConfigStubSettings) getStubSettings()).getTerraformVersionSettings();
}

/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings() {
Expand Down Expand Up @@ -545,6 +561,21 @@ public UnaryCallSettings.Builder<DeletePreviewRequest, Operation> deletePreviewS
return getStubSettingsBuilder().exportPreviewResultSettings();
}

/** Returns the builder for the settings used for calls to listTerraformVersions. */
public PagedCallSettings.Builder<
ListTerraformVersionsRequest,
ListTerraformVersionsResponse,
ListTerraformVersionsPagedResponse>
listTerraformVersionsSettings() {
return getStubSettingsBuilder().listTerraformVersionsSettings();
}

/** Returns the builder for the settings used for calls to getTerraformVersion. */
public UnaryCallSettings.Builder<GetTerraformVersionRequest, TerraformVersion>
getTerraformVersionSettings() {
return getStubSettingsBuilder().getTerraformVersionSettings();
}

/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
"GetRevision": {
"methods": ["getRevision", "getRevision", "getRevision", "getRevisionCallable"]
},
"GetTerraformVersion": {
"methods": ["getTerraformVersion", "getTerraformVersion", "getTerraformVersion", "getTerraformVersionCallable"]
},
"ImportStatefile": {
"methods": ["importStatefile", "importStatefile", "importStatefile", "importStatefileCallable"]
},
Expand All @@ -73,6 +76,9 @@
"ListRevisions": {
"methods": ["listRevisions", "listRevisions", "listRevisions", "listRevisionsPagedCallable", "listRevisionsCallable"]
},
"ListTerraformVersions": {
"methods": ["listTerraformVersions", "listTerraformVersions", "listTerraformVersions", "listTerraformVersionsPagedCallable", "listTerraformVersionsCallable"]
},
"LockDeployment": {
"methods": ["lockDeploymentAsync", "lockDeploymentAsync", "lockDeploymentAsync", "lockDeploymentOperationCallable", "lockDeploymentCallable"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static com.google.cloud.config.v1.ConfigClient.ListPreviewsPagedResponse;
import static com.google.cloud.config.v1.ConfigClient.ListResourcesPagedResponse;
import static com.google.cloud.config.v1.ConfigClient.ListRevisionsPagedResponse;
import static com.google.cloud.config.v1.ConfigClient.ListTerraformVersionsPagedResponse;

import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.OperationCallable;
Expand All @@ -40,6 +41,7 @@
import com.google.cloud.config.v1.GetPreviewRequest;
import com.google.cloud.config.v1.GetResourceRequest;
import com.google.cloud.config.v1.GetRevisionRequest;
import com.google.cloud.config.v1.GetTerraformVersionRequest;
import com.google.cloud.config.v1.ImportStatefileRequest;
import com.google.cloud.config.v1.ListDeploymentsRequest;
import com.google.cloud.config.v1.ListDeploymentsResponse;
Expand All @@ -49,13 +51,16 @@
import com.google.cloud.config.v1.ListResourcesResponse;
import com.google.cloud.config.v1.ListRevisionsRequest;
import com.google.cloud.config.v1.ListRevisionsResponse;
import com.google.cloud.config.v1.ListTerraformVersionsRequest;
import com.google.cloud.config.v1.ListTerraformVersionsResponse;
import com.google.cloud.config.v1.LockDeploymentRequest;
import com.google.cloud.config.v1.LockInfo;
import com.google.cloud.config.v1.OperationMetadata;
import com.google.cloud.config.v1.Preview;
import com.google.cloud.config.v1.Resource;
import com.google.cloud.config.v1.Revision;
import com.google.cloud.config.v1.Statefile;
import com.google.cloud.config.v1.TerraformVersion;
import com.google.cloud.config.v1.UnlockDeploymentRequest;
import com.google.cloud.config.v1.UpdateDeploymentRequest;
import com.google.cloud.location.GetLocationRequest;
Expand Down Expand Up @@ -230,6 +235,21 @@ public UnaryCallable<DeletePreviewRequest, Operation> deletePreviewCallable() {
throw new UnsupportedOperationException("Not implemented: exportPreviewResultCallable()");
}

public UnaryCallable<ListTerraformVersionsRequest, ListTerraformVersionsPagedResponse>
listTerraformVersionsPagedCallable() {
throw new UnsupportedOperationException(
"Not implemented: listTerraformVersionsPagedCallable()");
}

public UnaryCallable<ListTerraformVersionsRequest, ListTerraformVersionsResponse>
listTerraformVersionsCallable() {
throw new UnsupportedOperationException("Not implemented: listTerraformVersionsCallable()");
}

public UnaryCallable<GetTerraformVersionRequest, TerraformVersion> getTerraformVersionCallable() {
throw new UnsupportedOperationException("Not implemented: getTerraformVersionCallable()");
}

public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable() {
throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static com.google.cloud.config.v1.ConfigClient.ListPreviewsPagedResponse;
import static com.google.cloud.config.v1.ConfigClient.ListResourcesPagedResponse;
import static com.google.cloud.config.v1.ConfigClient.ListRevisionsPagedResponse;
import static com.google.cloud.config.v1.ConfigClient.ListTerraformVersionsPagedResponse;

import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
Expand Down Expand Up @@ -66,6 +67,7 @@
import com.google.cloud.config.v1.GetPreviewRequest;
import com.google.cloud.config.v1.GetResourceRequest;
import com.google.cloud.config.v1.GetRevisionRequest;
import com.google.cloud.config.v1.GetTerraformVersionRequest;
import com.google.cloud.config.v1.ImportStatefileRequest;
import com.google.cloud.config.v1.ListDeploymentsRequest;
import com.google.cloud.config.v1.ListDeploymentsResponse;
Expand All @@ -75,13 +77,16 @@
import com.google.cloud.config.v1.ListResourcesResponse;
import com.google.cloud.config.v1.ListRevisionsRequest;
import com.google.cloud.config.v1.ListRevisionsResponse;
import com.google.cloud.config.v1.ListTerraformVersionsRequest;
import com.google.cloud.config.v1.ListTerraformVersionsResponse;
import com.google.cloud.config.v1.LockDeploymentRequest;
import com.google.cloud.config.v1.LockInfo;
import com.google.cloud.config.v1.OperationMetadata;
import com.google.cloud.config.v1.Preview;
import com.google.cloud.config.v1.Resource;
import com.google.cloud.config.v1.Revision;
import com.google.cloud.config.v1.Statefile;
import com.google.cloud.config.v1.TerraformVersion;
import com.google.cloud.config.v1.UnlockDeploymentRequest;
import com.google.cloud.config.v1.UpdateDeploymentRequest;
import com.google.cloud.location.GetLocationRequest;
Expand Down Expand Up @@ -192,6 +197,13 @@ public class ConfigStubSettings extends StubSettings<ConfigStubSettings> {
deletePreviewOperationSettings;
private final UnaryCallSettings<ExportPreviewResultRequest, ExportPreviewResultResponse>
exportPreviewResultSettings;
private final PagedCallSettings<
ListTerraformVersionsRequest,
ListTerraformVersionsResponse,
ListTerraformVersionsPagedResponse>
listTerraformVersionsSettings;
private final UnaryCallSettings<GetTerraformVersionRequest, TerraformVersion>
getTerraformVersionSettings;
private final PagedCallSettings<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings;
Expand Down Expand Up @@ -348,6 +360,47 @@ public Iterable<Preview> extractResources(ListPreviewsResponse payload) {
}
};

private static final PagedListDescriptor<
ListTerraformVersionsRequest, ListTerraformVersionsResponse, TerraformVersion>
LIST_TERRAFORM_VERSIONS_PAGE_STR_DESC =
new PagedListDescriptor<
ListTerraformVersionsRequest, ListTerraformVersionsResponse, TerraformVersion>() {
@Override
public String emptyToken() {
return "";
}

@Override
public ListTerraformVersionsRequest injectToken(
ListTerraformVersionsRequest payload, String token) {
return ListTerraformVersionsRequest.newBuilder(payload).setPageToken(token).build();
}

@Override
public ListTerraformVersionsRequest injectPageSize(
ListTerraformVersionsRequest payload, int pageSize) {
return ListTerraformVersionsRequest.newBuilder(payload).setPageSize(pageSize).build();
}

@Override
public Integer extractPageSize(ListTerraformVersionsRequest payload) {
return payload.getPageSize();
}

@Override
public String extractNextToken(ListTerraformVersionsResponse payload) {
return payload.getNextPageToken();
}

@Override
public Iterable<TerraformVersion> extractResources(
ListTerraformVersionsResponse payload) {
return payload.getTerraformVersionsList() == null
? ImmutableList.<TerraformVersion>of()
: payload.getTerraformVersionsList();
}
};

private static final PagedListDescriptor<ListLocationsRequest, ListLocationsResponse, Location>
LIST_LOCATIONS_PAGE_STR_DESC =
new PagedListDescriptor<ListLocationsRequest, ListLocationsResponse, Location>() {
Expand Down Expand Up @@ -452,6 +505,30 @@ public ApiFuture<ListPreviewsPagedResponse> getFuturePagedResponse(
}
};

private static final PagedListResponseFactory<
ListTerraformVersionsRequest,
ListTerraformVersionsResponse,
ListTerraformVersionsPagedResponse>
LIST_TERRAFORM_VERSIONS_PAGE_STR_FACT =
new PagedListResponseFactory<
ListTerraformVersionsRequest,
ListTerraformVersionsResponse,
ListTerraformVersionsPagedResponse>() {
@Override
public ApiFuture<ListTerraformVersionsPagedResponse> getFuturePagedResponse(
UnaryCallable<ListTerraformVersionsRequest, ListTerraformVersionsResponse> callable,
ListTerraformVersionsRequest request,
ApiCallContext context,
ApiFuture<ListTerraformVersionsResponse> futureResponse) {
PageContext<
ListTerraformVersionsRequest, ListTerraformVersionsResponse, TerraformVersion>
pageContext =
PageContext.create(
callable, LIST_TERRAFORM_VERSIONS_PAGE_STR_DESC, request, context);
return ListTerraformVersionsPagedResponse.createAsync(pageContext, futureResponse);
}
};

private static final PagedListResponseFactory<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
LIST_LOCATIONS_PAGE_STR_FACT =
Expand Down Expand Up @@ -624,6 +701,21 @@ public UnaryCallSettings<DeletePreviewRequest, Operation> deletePreviewSettings(
return exportPreviewResultSettings;
}

/** Returns the object with the settings used for calls to listTerraformVersions. */
public PagedCallSettings<
ListTerraformVersionsRequest,
ListTerraformVersionsResponse,
ListTerraformVersionsPagedResponse>
listTerraformVersionsSettings() {
return listTerraformVersionsSettings;
}

/** Returns the object with the settings used for calls to getTerraformVersion. */
public UnaryCallSettings<GetTerraformVersionRequest, TerraformVersion>
getTerraformVersionSettings() {
return getTerraformVersionSettings;
}

/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings() {
Expand Down Expand Up @@ -796,6 +888,8 @@ protected ConfigStubSettings(Builder settingsBuilder) throws IOException {
deletePreviewSettings = settingsBuilder.deletePreviewSettings().build();
deletePreviewOperationSettings = settingsBuilder.deletePreviewOperationSettings().build();
exportPreviewResultSettings = settingsBuilder.exportPreviewResultSettings().build();
listTerraformVersionsSettings = settingsBuilder.listTerraformVersionsSettings().build();
getTerraformVersionSettings = settingsBuilder.getTerraformVersionSettings().build();
listLocationsSettings = settingsBuilder.listLocationsSettings().build();
getLocationSettings = settingsBuilder.getLocationSettings().build();
setIamPolicySettings = settingsBuilder.setIamPolicySettings().build();
Expand Down Expand Up @@ -863,6 +957,13 @@ public static class Builder extends StubSettings.Builder<ConfigStubSettings, Bui
deletePreviewOperationSettings;
private final UnaryCallSettings.Builder<ExportPreviewResultRequest, ExportPreviewResultResponse>
exportPreviewResultSettings;
private final PagedCallSettings.Builder<
ListTerraformVersionsRequest,
ListTerraformVersionsResponse,
ListTerraformVersionsPagedResponse>
listTerraformVersionsSettings;
private final UnaryCallSettings.Builder<GetTerraformVersionRequest, TerraformVersion>
getTerraformVersionSettings;
private final PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings;
Expand Down Expand Up @@ -926,6 +1027,9 @@ protected Builder(ClientContext clientContext) {
deletePreviewSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
deletePreviewOperationSettings = OperationCallSettings.newBuilder();
exportPreviewResultSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listTerraformVersionsSettings =
PagedCallSettings.newBuilder(LIST_TERRAFORM_VERSIONS_PAGE_STR_FACT);
getTerraformVersionSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT);
getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
Expand Down Expand Up @@ -955,6 +1059,8 @@ protected Builder(ClientContext clientContext) {
listPreviewsSettings,
deletePreviewSettings,
exportPreviewResultSettings,
listTerraformVersionsSettings,
getTerraformVersionSettings,
listLocationsSettings,
getLocationSettings,
setIamPolicySettings,
Expand Down Expand Up @@ -994,6 +1100,8 @@ protected Builder(ConfigStubSettings settings) {
deletePreviewSettings = settings.deletePreviewSettings.toBuilder();
deletePreviewOperationSettings = settings.deletePreviewOperationSettings.toBuilder();
exportPreviewResultSettings = settings.exportPreviewResultSettings.toBuilder();
listTerraformVersionsSettings = settings.listTerraformVersionsSettings.toBuilder();
getTerraformVersionSettings = settings.getTerraformVersionSettings.toBuilder();
listLocationsSettings = settings.listLocationsSettings.toBuilder();
getLocationSettings = settings.getLocationSettings.toBuilder();
setIamPolicySettings = settings.setIamPolicySettings.toBuilder();
Expand Down Expand Up @@ -1023,6 +1131,8 @@ protected Builder(ConfigStubSettings settings) {
listPreviewsSettings,
deletePreviewSettings,
exportPreviewResultSettings,
listTerraformVersionsSettings,
getTerraformVersionSettings,
listLocationsSettings,
getLocationSettings,
setIamPolicySettings,
Expand Down Expand Up @@ -1160,6 +1270,16 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));

builder
.listTerraformVersionsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));

builder
.getTerraformVersionSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));

builder
.listLocationsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
Expand Down Expand Up @@ -1533,6 +1653,21 @@ public UnaryCallSettings.Builder<DeletePreviewRequest, Operation> deletePreviewS
return exportPreviewResultSettings;
}

/** Returns the builder for the settings used for calls to listTerraformVersions. */
public PagedCallSettings.Builder<
ListTerraformVersionsRequest,
ListTerraformVersionsResponse,
ListTerraformVersionsPagedResponse>
listTerraformVersionsSettings() {
return listTerraformVersionsSettings;
}

/** Returns the builder for the settings used for calls to getTerraformVersion. */
public UnaryCallSettings.Builder<GetTerraformVersionRequest, TerraformVersion>
getTerraformVersionSettings() {
return getTerraformVersionSettings;
}

/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
Expand Down
Loading
Loading