use of com.google.cloud.bigquery.connection.v1.AwsProperties in project java-bigqueryconnection by googleapis.
the class CreateAwsConnectionIT method testCreateAwsConnection.
@Test
public void testCreateAwsConnection() throws IOException {
String iamRoleId = String.format("arn:aws:iam::%s:role/%s", AWS_ACCOUNT_ID, AWS_ROLE_ID);
AwsAccessRole awsRole = AwsAccessRole.newBuilder().setIamRoleId(iamRoleId).build();
AwsProperties awsProperties = AwsProperties.newBuilder().setAccessRole(awsRole).build();
Connection connection = Connection.newBuilder().setAws(awsProperties).build();
CreateAwsConnection.createAwsConnection(PROJECT_ID, LOCATION, connectionId, connection);
assertThat(bout.toString()).contains("Aws connection created successfully :");
}
use of com.google.cloud.bigquery.connection.v1.AwsProperties in project java-bigqueryconnection by googleapis.
the class CreateAwsConnection method main.
public static void main(String[] args) throws IOException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "MY_PROJECT_ID";
// Note: As of now location only supports aws-us-east-1
String location = "MY_LOCATION";
String connectionId = "MY_CONNECTION_ID";
// Example of role id arn:aws:iam::accountId:role/myrole
String iamRoleId = "MY_AWS_ROLE_ID";
AwsCrossAccountRole role = AwsCrossAccountRole.newBuilder().setIamRoleId(iamRoleId).build();
AwsProperties awsProperties = AwsProperties.newBuilder().setCrossAccountRole(role).build();
Connection connection = Connection.newBuilder().setAws(awsProperties).build();
createAwsConnection(projectId, location, connectionId, connection);
}
Aggregations