Skip to content

docs: samples and tests for auto-generated createDatabase and createInstance APIs. #2764

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

Merged
merged 26 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
edc5bbf
fix: prevent illegal negative timeout values into thread sleep() meth…
arpan14 Feb 6, 2023
49a85df
Merge pull request #1 from arpan14/retryerror
arpan14 Feb 8, 2023
4cd497b
Fixing lint issues.
arpan14 Feb 8, 2023
4a6aa8e
Merge branch 'googleapis:main' into main
arpan14 Mar 13, 2023
b2aa09d
Merge branch 'googleapis:main' into main
arpan14 Mar 15, 2023
8d6d71e
Merge branch 'googleapis:main' into main
arpan14 May 9, 2023
77e6e7d
Merge branch 'googleapis:main' into main
arpan14 Jul 17, 2023
e8b7fad
Merge branch 'googleapis:main' into main
arpan14 Jul 25, 2023
8aa84e1
Merge branch 'googleapis:main' into main
arpan14 Oct 10, 2023
57fd405
Merge branch 'googleapis:main' into main
arpan14 Oct 27, 2023
1253563
Merge branch 'googleapis:main' into main
arpan14 Nov 20, 2023
c249a05
chore: adding a few samples with auto-gen clients.
arpan14 Nov 29, 2023
6eb9f2d
chore: adding integration tests for samples.
arpan14 Dec 18, 2023
e2baca9
chore: fixing the end-point for staging.
arpan14 Dec 21, 2023
01a2369
chore: modified test for CreateDatabaseWithDefaultLeaderSample.
arpan14 Dec 21, 2023
8daf0df
chore: adding sample and integration test for CreateInstanceSample.
arpan14 Dec 21, 2023
22dbd2f
chore: adding license headers.
arpan14 Dec 21, 2023
b0ce7ca
chore: fix lint errors.
arpan14 Dec 21, 2023
cfada59
chore: rename file and add sample tags.
arpan14 Dec 23, 2023
4846143
chore: address comments.
arpan14 Dec 23, 2023
17bf04d
Update samples/snippets/src/main/java/com/example/spanner/v2/CreateDa…
arpan14 Dec 23, 2023
6087d7f
chore: rename file path.
arpan14 Dec 26, 2023
033a505
chore: remove admin settings.
arpan14 Dec 26, 2023
91febb4
Merge branch 'googleapis:main' into auto-gen-admin-client
arpan14 Dec 26, 2023
2bb6e11
chore: address comments.
arpan14 Dec 26, 2023
a20463e
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Jan 1, 2024
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: address comments.
  • Loading branch information
arpan14 committed Dec 23, 2023
commit 48461439ffc92e97d3cf42528d5a0ac73f44b888
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class CreateDatabaseWithDefaultLeaderSample {

static void createDatabaseWithDefaultLeader() throws IOException {
// TODO(developer): Replace these variables before running the sample.
final String instanceName = "my-instance-name";
final String instanceName = "projects/my-project/instances/my-instance-id";
final String databaseId = "my-database-name";
final String defaultLeader = "my-default-leader";
createDatabaseWithDefaultLeader(instanceName, databaseId, defaultLeader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

//[START spanner_create_instance]
import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.spanner.SpannerExceptionFactory;
import com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient;
import com.google.cloud.spanner.admin.instance.v1.InstanceAdminSettings;
import com.google.spanner.admin.instance.v1.CreateInstanceMetadata;
Expand Down Expand Up @@ -72,10 +71,8 @@ static void createInstance(String projectId, String instanceId) throws IOExcepti
System.out.printf(
"Error: Creating instance %s failed with error message %s%n",
instance.getName(), e.getMessage());
throw SpannerExceptionFactory.asSpannerException(e);
} catch (InterruptedException e) {
System.out.println("Error: Waiting for createInstance operation to finish was interrupted");
throw SpannerExceptionFactory.propagateInterrupt(e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void testCreateInstance() throws Exception {

// Runs sample
final String out = SampleRunner.runSample(() ->
CreateInstanceSample.createInstance(projectId, instanceId)
CreateInstanceExample.createInstance(projectId, instanceId)
);

assertTrue(
Expand Down