use of org.geotoolkit.sml.xml.v100.Connection in project java-bigqueryconnection by googleapis.
the class UpdateConnection method main.
public static void main(String[] args) throws IOException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "MY_PROJECT_ID";
String location = "MY_LOCATION";
String connectionId = "MY_CONNECTION_ID";
String description = "MY_DESCRIPTION";
Connection connection = Connection.newBuilder().setDescription(description).build();
updateConnection(projectId, location, connectionId, connection);
}
use of org.geotoolkit.sml.xml.v100.Connection in project java-bigqueryconnection by googleapis.
the class UpdateConnection method updateConnection.
public static void updateConnection(String projectId, String location, String connectionId, Connection connection) throws IOException {
try (ConnectionServiceClient client = ConnectionServiceClient.create()) {
ConnectionName name = ConnectionName.of(projectId, location, connectionId);
FieldMask updateMask = FieldMaskUtil.fromString("description");
UpdateConnectionRequest request = UpdateConnectionRequest.newBuilder().setName(name.toString()).setConnection(connection).setUpdateMask(updateMask).build();
Connection response = client.updateConnection(request);
System.out.println("Connection updated successfully :" + response.getDescription());
}
}
use of org.geotoolkit.sml.xml.v100.Connection 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 org.geotoolkit.sml.xml.v100.Connection in project java-bigqueryconnection by googleapis.
the class ListConnectionsIT method setUp.
@Before
public void setUp() throws IOException {
bout = new ByteArrayOutputStream();
out = new PrintStream(bout);
originalPrintStream = System.out;
System.setOut(out);
// create a temporary connection
connectionId = "LIST_CONNECTIONS_TEST_" + UUID.randomUUID().toString().substring(0, 8);
String instanceId = String.format("%s:%s:%s", PROJECT_ID, REGION, MY_SQL_INSTANCE);
CloudSqlCredential cloudSqlCredential = CloudSqlCredential.newBuilder().setUsername(DB_USER).setPassword(DB_PWD).build();
CloudSqlProperties cloudSqlProperties = CloudSqlProperties.newBuilder().setType(CloudSqlProperties.DatabaseType.MYSQL).setDatabase(MY_SQL_DATABASE).setInstanceId(instanceId).setCredential(cloudSqlCredential).build();
Connection connection = Connection.newBuilder().setCloudSql(cloudSqlProperties).build();
CreateConnection.createConnection(PROJECT_ID, LOCATION, connectionId, connection);
}
use of org.geotoolkit.sml.xml.v100.Connection in project java-bigqueryconnection by googleapis.
the class UpdateConnectionIT method setUp.
@Before
public void setUp() throws IOException {
bout = new ByteArrayOutputStream();
out = new PrintStream(bout);
originalPrintStream = System.out;
System.setOut(out);
// create a temporary connection
connectionId = "UPDATE_CONNECTION_TEST_" + UUID.randomUUID().toString().substring(0, 8);
String instanceId = String.format("%s:%s:%s", PROJECT_ID, REGION, MY_SQL_INSTANCE);
CloudSqlCredential cloudSqlCredential = CloudSqlCredential.newBuilder().setUsername(DB_USER).setPassword(DB_PWD).build();
CloudSqlProperties cloudSqlProperties = CloudSqlProperties.newBuilder().setType(CloudSqlProperties.DatabaseType.MYSQL).setDatabase(MY_SQL_DATABASE).setInstanceId(instanceId).setCredential(cloudSqlCredential).build();
Connection connection = Connection.newBuilder().setCloudSql(cloudSqlProperties).build();
CreateConnection.createConnection(PROJECT_ID, LOCATION, connectionId, connection);
}
Aggregations