Search in sources :

Example 1 with AwsProperties

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 :");
}
Also used : AwsAccessRole(com.google.cloud.bigquery.connection.v1.AwsAccessRole) AwsProperties(com.google.cloud.bigquery.connection.v1.AwsProperties) Connection(com.google.cloud.bigquery.connection.v1.Connection) Test(org.junit.Test)

Example 2 with AwsProperties

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);
}
Also used : AwsCrossAccountRole(com.google.cloud.bigquery.connection.v1.AwsCrossAccountRole) AwsProperties(com.google.cloud.bigquery.connection.v1.AwsProperties) Connection(com.google.cloud.bigquery.connection.v1.Connection)

Aggregations

AwsProperties (com.google.cloud.bigquery.connection.v1.AwsProperties)2 Connection (com.google.cloud.bigquery.connection.v1.Connection)2 AwsAccessRole (com.google.cloud.bigquery.connection.v1.AwsAccessRole)1 AwsCrossAccountRole (com.google.cloud.bigquery.connection.v1.AwsCrossAccountRole)1 Test (org.junit.Test)1