use of com.google.cloud.bigquery.connection.v1.CloudSqlProperties in project java-bigqueryconnection by googleapis.
the class DeleteConnectionIT 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 = "DELETE_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);
}
use of com.google.cloud.bigquery.connection.v1.CloudSqlProperties in project java-bigqueryconnection by googleapis.
the class GetConnectionIT 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 = "GET_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);
}
use of com.google.cloud.bigquery.connection.v1.CloudSqlProperties in project java-bigqueryconnection by googleapis.
the class ShareConnectionIT 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 = "SHARE_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