profile
viewpoint
Shubha Rajan shubha-rajan Seattle, WA shubharajan.com Developer Programs Engineer @google, @Ada-Developers-Academy alum http://pronoun.is/she?or=they

drunkONdata/carpe_datum 1

NASA SpaceApps 2019

hanalways/betsy 1

Project: Create an e-commerce web app

gracemshea/adagrams 0

Project: Create the code for the fictional anagram game Adagrams, practicing data manipulation

gracemshea/spaceapps2019 0

@shubha-rajan @gracemshea contribution to spaceapps hackathon project

hanalways/misgender.me 0

TechTogether - Boston Hackathon 2019

jessicacaley/carnival-recipes 0

Recipe scraps for Merge Conflict Carnival activity

KateAnnNichols/pr-practice 0

Repo to practice working with PRs

ln1draw/nwnets 0

nwnets slash codethecampsv2

push eventGoogleCloudPlatform/cloudsql-proxy

Jarrod Mosen

commit sha bc210fa23db52736426e61421d4c7ed54546047a

docs: Fix typo in README (#422)

view details

Shubha Rajan

commit sha b9879d09f7a9872480e43393aef77dc389f14e4c

remove 'v' from tag

view details

push time in a day

push eventGoogleCloudPlatform/cloudsql-proxy

Jarrod Mosen

commit sha bc210fa23db52736426e61421d4c7ed54546047a

docs: Fix typo in README (#422)

view details

push time in a day

PR merged GoogleCloudPlatform/cloudsql-proxy

Fix typo in README cla: yes

Change Description

Change debain to debian in README.md

+1 -1

1 comment

1 changed file

wub

pr closed time in a day

pull request commentGoogleCloudPlatform/cloudsql-proxy

Fix typo in README

Thanks for the PR!

wub

comment created time in 6 days

push eventGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

WhiteSource Renovate

commit sha 2030652aab01d43c30f2f3b7495c3acd154f40ee

chore(deps): update dependency org.mockito:mockito-core to v3.4.6 (#238)

view details

push time in 6 days

PR merged GoogleCloudPlatform/cloud-sql-jdbc-socket-factory

chore(deps): update dependency org.mockito:mockito-core to v3.4.6

This PR contains the following updates:

Package Update Change
org.mockito:mockito-core patch 3.4.4 -> 3.4.6

Release Notes

<details> <summary>mockito/mockito</summary>

v3.4.6

Compare Source

<sup><sup>Release notes were automatically generated by Shipkit</sup></sup>

3.4.6

</details>


Renovate configuration

:date: Schedule: At any time (no schedule defined).

:vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.

:recycle: Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

:no_bell: Ignore: Close this PR and you won't be reminded about this update again.


  • [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

This PR has been generated by WhiteSource Renovate. View repository job log here.

+1 -1

0 comment

1 changed file

renovate-bot

pr closed time in 6 days

push eventGoogleCloudPlatform/cloudsql-proxy

Shubha Rajan

commit sha 7b53feabf2957600deda846b9e68b243eb03c26c

remove 'v' from tag

view details

push time in 7 days

issue commentGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Depending on several ASM lib versions

Thanks for catching this and opening the PR @artieshevchenko. We'll look in to adding the dependencyConvergence rule to fix this.

artieshevchenko

comment created time in 11 days

pull request commentGoogleCloudPlatform/cloudsql-proxy

Update README.md

I think backporting makes sense. As for pushing both versions in the future, would it break users if we only pushed the v$VERSION and do we want to officially support both tags?

shubha-rajan

comment created time in 12 days

issue commentGoogleCloudPlatform/java-docs-samples

Bigtable updates from RenovateBot are incompatible...

Can we modify the tests to capture StdOut and use assertThat to verify that there's a success message printed out? That way if the assertion is false it'll print the diff. I've seen other tests do that.

lesv

comment created time in 12 days

pull request commentGoogleCloudPlatform/java-docs-samples

chore(deps): update dependency com.google.cloud:google-cloud-bigtable to v1.14.0

I think this one might just be a timing issue. I ran the tests locally a few times with the java-docs-samples-testing project and they worked all but once, where it threw an error because it tried to delete a nonexistent instance. maybe we should add a sleep before the asserts to give some time to create the instance?

renovate-bot

comment created time in 14 days

push eventshubha-rajan/java-docs-samples

noerog

commit sha ee7893db3cfc62c9eec03e4fb06f7ba99072ef97

Heathcare API: fix HL7v2 resource path and console output for HL7v2MessageList (#2044)

view details

Grant Timmerman

commit sha 86eba3be8c06f6898ca0cabb3d937f112055801c

feat: add functions_firebase_auth (#2050) * feat: add functions_firebase_auth * Update FirebaseAuth.java * feat: add json parsing logic

view details

Noah Negrey

commit sha deb71c640ed3c2fdbb1010f0bd3dd72da4cd887b

translate: use unique gcs folders for batch translate tests (#2053) * translate: use unique gcs folders for batch translate tests * update based on feedback * fix typo

view details

Averi Kitsch

commit sha c8c2799b14869c44995aea14ce366e46f2b790c8

Undo deleted IAP sample (#2057) * Readd sample * Update ReadMe.md

view details

Averi Kitsch

commit sha e9dd9fec30579bbaf401accd4f674d05e1362372

Update pom.xml to fix build errors (#2056) * Update pom.xml * update version

view details

Averi Kitsch

commit sha f9267b753e0d6fbc289fd0a07777c527a49850c9

Update Kokoro java versions (#2059) * Fix kokoro test versions * trigger tests * fix removal * Fix error

view details

Jonathan Simon

commit sha 2dfe7f19f8cd0d31e8785a43e701767b0582e6a0

Delete old Bigquery samples and link new location. (#2060)

view details

Noah Negrey

commit sha 36af560b0bb7e65995e7d67e3a1edc9b547cf61a

automl-beta: update samples and move them to master for video (#2014) * automl-beta: update samples and move them to master for video * Update project to automl project * Lint

view details

Shubha Rajan

commit sha ba79255d96c87995216fdee54a25a6098e06c0e7

Cleanup DLP Metadata and Jobs snippets (#2054) * refactored Metadata.java and corresponding tests to snippet format * Refactored Jobs.java into snippets and updated integration tests * removed unnecessary imports * added step to create job in JobTests.java * Update dlp/src/main/java/dlp/snippets/InspectTextFile.java Co-Authored-By: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com> * Update dlp/src/main/java/dlp/snippets/InfoTypesList.java Co-Authored-By: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com> * Update dlp/src/main/java/dlp/snippets/InfoTypesList.java Co-Authored-By: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com> * Update dlp/src/main/java/dlp/snippets/InspectGcsFile.java Co-Authored-By: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com> * minor refactoring and fixups * added @BeforeClass annotation to checkRequirements * updated documentation * removed GCS_PATH env variable * updated jobs tests * updated imports Co-authored-by: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com>

view details

WhiteSource Renovate

commit sha 1f909099a2f58b5b9fa0c0164e643445b429b61e

Update beam.version to v2.19.0 (#2068)

view details

Averi Kitsch

commit sha fec547ebf65a479d7d2a724af791de1898208198

Add helloworld Cloud Run Sample (#2067) * Add helloworld Cloud Run Sample * format pom * fix pom * fix docker * Add repackage

view details

Mike

commit sha 88ae90245aa8a6f6ddc84f8fdc47ada35326aeb3

feat: face and person detection samples (#2066) Co-authored-by: Les Vogel <lesv@users.noreply.github.com>

view details

Shubha Rajan

commit sha ec118f9b2ad1d4791452e4c0862859ffb2f8370e

Cleanup DLP Triggers Snippets (#2062) * refactored triggers samples into snippet format * removed extra newline * Remove extra newline. Co-authored-by: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com>

view details

Shubha Rajan

commit sha 22b32cf4a3de56e8050b233a55ba3b12f044f86c

Cleanup DLP Templates Snippets (#2065) * refactored templates snippets * Update dlp/src/main/java/dlp/snippets/TemplatesCreate.java Co-Authored-By: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com> Co-authored-by: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com>

view details

Kurtis Van Gent

commit sha b9a5132a47df2f490220ea0fb78b7e29b1248f64

Remove PR limit. (#2071) (We should probably wait until Tuesday to kick this off)

view details

Knut Olav Løite

commit sha c2188a9efd2e62667efcf168ebe2de9487ee2ab2

fix: default to PickFirstLoadBalancerProvider (#2063) The services/META-INF/io.grpc.LoadBalancerProvider file included by default in the jar with dependencies did not correspond with the default pick_first policy of AutoConfiguredLoadBalancerFactory. Fixes #2061 Co-authored-by: Les Vogel <lesv@users.noreply.github.com>

view details

WhiteSource Renovate

commit sha eb6ae3af8f0962c41e4c449f8899826168cc3608

Update dependency com.google.api-client:google-api-client-appengine to v1.30.8 (#2072) Co-authored-by: Les Vogel <lesv@users.noreply.github.com>

view details

WhiteSource Renovate

commit sha 26f365a2d0812d02c287b6b8d77a8d34ca0f1323

chore(deps): update dependency com.amazonaws:aws-java-sdk-s3 to v1.11.723 (#2037) Co-authored-by: Les Vogel <lesv@users.noreply.github.com>

view details

Mike

commit sha 3531611f3f37e21e041f7bd84f0f4b7621900c58

talent solution: moving published samples into master (#2033) * ls * reformatted * made requested changes broke down ITs * Update jobs/v4/pom.xml Co-Authored-By: Noah Negrey <nnegrey@users.noreply.github.com> * Update jobs/v4/pom.xml Co-Authored-By: Noah Negrey <nnegrey@users.noreply.github.com> * renamed packages, removed _core tags, added beta tags * added missing version * broke down tests and added DO_NOT_DELTE job, company, tenant * reduced createJob parms Co-authored-by: Noah Negrey <nnegrey@users.noreply.github.com> Co-authored-by: Les Vogel <lesv@users.noreply.github.com>

view details

nnegrey

commit sha 3cf5457ad041597ecc0843978455e22841f801f6

automl-beta: copy v1 samples to beta folder and update imports

view details

push time in 14 days

PR merged GoogleCloudPlatform/cloud-sql-jdbc-socket-factory

chore(deps): update dependency org.mockito:mockito-core to v3.4.4

This PR contains the following updates:

Package Update Change
org.mockito:mockito-core patch 3.4.3 -> 3.4.4

Release Notes

<details> <summary>mockito/mockito</summary>

v3.4.4

Compare Source

<sup><sup>Release notes were automatically generated by Shipkit</sup></sup>

3.4.4

</details>


Renovate configuration

:date: Schedule: At any time (no schedule defined).

:vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.

:recycle: Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

:no_bell: Ignore: Close this PR and you won't be reminded about this update again.


  • [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

This PR has been generated by WhiteSource Renovate. View repository job log here.

+1 -1

0 comment

1 changed file

renovate-bot

pr closed time in 15 days

push eventGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

WhiteSource Renovate

commit sha d8b7d6a2de4bb189d55c4ebe80bdeb01f489b68d

chore(deps): update dependency org.mockito:mockito-core to v3.4.4 (#234)

view details

push time in 15 days

push eventGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

WhiteSource Renovate

commit sha ac53f8db26e0bb9ad8dbb53f388d95c3ed490632

chore(deps): update dependency org.mockito:mockito-core to v3.4.3 (#233)

view details

push time in 18 days

PR merged GoogleCloudPlatform/cloud-sql-jdbc-socket-factory

chore(deps): update dependency org.mockito:mockito-core to v3.4.3

This PR contains the following updates:

Package Update Change
org.mockito:mockito-core patch 3.4.2 -> 3.4.3

Release Notes

<details> <summary>mockito/mockito</summary>

v3.4.3

Compare Source

<sup><sup>Release notes were automatically generated by Shipkit</sup></sup>

3.4.3

</details>


Renovate configuration

:date: Schedule: At any time (no schedule defined).

:vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.

:recycle: Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

:no_bell: Ignore: Close this PR and you won't be reminded about this update again.


  • [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

This PR has been generated by WhiteSource Renovate. View repository job log here.

+1 -1

0 comment

1 changed file

renovate-bot

pr closed time in 18 days

PR closed drunkONdata/carpe_datum

Upload results to GCS in a zip

Resulting files are now written into a single zip file instead of 4 separate files

+28 -22

0 comment

1 changed file

shubha-rajan

pr closed time in 19 days

PR opened GoogleCloudPlatform/cloudsql-proxy

Update README.md

Change Description

Updated documentation for proxy container images in README.md

Relevant issues:

  • Fixes #418
+3 -3

0 comment

1 changed file

pr created time in 19 days

create barnchGoogleCloudPlatform/cloudsql-proxy

branch : shubha-rajan-patch-1

created branch time in 19 days

issue commentGoogleCloudPlatform/cloudsql-proxy

Wrong Docker Image Tags

Thanks for catching this and opening the issue! We'll open a PR to update the docs.

mbyio

comment created time in 19 days

push eventGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

WhiteSource Renovate

commit sha 13dc18593bffaf127a508dcbbb2c390d6003c44c

chore(deps): update dependency org.mockito:mockito-core to v3.4.2 (#232)

view details

push time in 19 days

PR merged GoogleCloudPlatform/cloud-sql-jdbc-socket-factory

chore(deps): update dependency org.mockito:mockito-core to v3.4.2

This PR contains the following updates:

Package Update Change
org.mockito:mockito-core patch 3.4.0 -> 3.4.2

Release Notes

<details> <summary>mockito/mockito</summary>

v3.4.2

Compare Source

<sup><sup>Release notes were automatically generated by Shipkit</sup></sup>

3.4.2

</details>


Renovate configuration

:date: Schedule: At any time (no schedule defined).

:vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.

:recycle: Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

:no_bell: Ignore: Close this PR and you won't be reminded about this update again.


  • [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

This PR has been generated by WhiteSource Renovate. View repository job log here.

+1 -1

0 comment

1 changed file

renovate-bot

pr closed time in 19 days

push eventshubha-rajan/golang-samples

Shubha Rajan

commit sha ee25b4f50cdfebfca2ba3ddfb552c5cad106d8a9

address review comments

view details

push time in 21 days

pull request commentGoogleCloudPlatform/golang-samples

cloudsql: update MySQL sample

@grayside ready for another review on this

shubha-rajan

comment created time in 21 days

pull request commentGoogleCloudPlatform/php-docs-samples

update CloudSQL samples to reflect updated TCP and Unix Socket connection methods

Is this ready for review? it's still marked as a draft FYI

SaketramDurbha

comment created time in 22 days

Pull request review commentGoogleCloudPlatform/php-docs-samples

update CloudSQL samples to reflect updated TCP and Unix Socket connection methods

  To run this application locally, download and install the `cloud_sql_proxy` by following the instructions [here](https://cloud.google.com/sql/docs/mysql/sql-proxy#install). -To authenticate with Cloud SQL, set the `$GOOGLE_APPLICATION_CREDENTIALS` environment variable:+Instructions are provided below for using the proxy with a TCP connection or a Unix domain socket. On Linux or macOS, you can use either option, but the Windows proxy currently requires a TCP connection.++### Unix Socket mode+NOTE: this option is currently only supported on Linux and macOS. Windows users whould use the TCP option.++To use a Unix socket, you'll need to create a directory and give write access to the user running the proxy. For example:  ```bash-export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account/key.json+sudo mkdir /cloudsql+sudo chown -R $USER /cloudsql

Replace this with either a template for a path or a different path that's copy-paste runnable on all machines, like ~/cloudsql

SaketramDurbha

comment created time in 22 days

push eventGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

WhiteSource Renovate

commit sha cbaf8eddd75f33105160cfcde36abb395b122e4b

chore(deps): update dependency org.mockito:mockito-core to v3.4.0 (#230)

view details

push time in 25 days

PR merged GoogleCloudPlatform/cloud-sql-jdbc-socket-factory

chore(deps): update dependency org.mockito:mockito-core to v3.4.0

This PR contains the following updates:

Package Update Change
org.mockito:mockito-core minor 3.3.3 -> 3.4.0

Release Notes

<details> <summary>mockito/mockito</summary>

v3.4.0

Compare Source

<sup><sup>Release notes were automatically generated by Shipkit</sup></sup>

3.4.0

</details>


Renovate configuration

:date: Schedule: At any time (no schedule defined).

:vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.

:recycle: Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

:no_bell: Ignore: Close this PR and you won't be reminded about this update again.


  • [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

This PR has been generated by WhiteSource Renovate. View repository job log here.

+1 -1

0 comment

1 changed file

renovate-bot

pr closed time in 25 days

push eventGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

WhiteSource Renovate

commit sha 40f9d1b3cc92c76588c11a2c55f6fc8aa7d78cda

chore(deps): update dependency com.github.jnr:jnr-unixsocket to v0.33 (#229)

view details

push time in 25 days

PR merged GoogleCloudPlatform/cloud-sql-jdbc-socket-factory

chore(deps): update dependency com.github.jnr:jnr-unixsocket to v0.33

This PR contains the following updates:

Package Update Change
com.github.jnr:jnr-unixsocket minor 0.32 -> 0.33

Renovate configuration

:date: Schedule: At any time (no schedule defined).

:vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.

:recycle: Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

:no_bell: Ignore: Close this PR and you won't be reminded about this update again.


  • [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

This PR has been generated by WhiteSource Renovate. View repository job log here.

+1 -1

0 comment

1 changed file

renovate-bot

pr closed time in 25 days

push eventGoogleCloudPlatform/cloudsql-proxy

Jonathan Simon

commit sha d21feccf100fcefc4dc8a43caa721f6821d08a0b

Update format of userAgent string (#414)

view details

push time in 25 days

PR merged GoogleCloudPlatform/cloudsql-proxy

Update format of userAgent string cla: yes

Change Description

Updates the format of the userAgent string returned by the userAgentFromVersionString function. An example of the new format returned is "cloud_sql_proxy/1.16"

Relevant issues:

  • Fixes #398
+3 -1

0 comment

1 changed file

jsimonweb

pr closed time in 25 days

issue closedGoogleCloudPlatform/cloudsql-proxy

Update UserAgent format for usage metrics

UserAgent should be in the format of "[tool-name]/[version]

For example:

  const defaultUserAgent = "cloud_sql_proxy/1.10"

closed time in 25 days

jsimonweb

pull request commentGoogleCloudPlatform/golang-samples

cloudsql: Add Postgres sample

sgtm. just updated the README to mirror some changes I made in a separate PR for the mysql sample.

shubha-rajan

comment created time in a month

push eventshubha-rajan/golang-samples

Shubha Rajan

commit sha e926b3be2fe7fc5d89cc8e686d07e2de529e291a

Update README.md

view details

push time in a month

push eventshubha-rajan/golang-samples

Shubha Rajan

commit sha 01270113b61d35ed6574112f517229a81bf86171

update readme for consistency

view details

push time in a month

pull request commentGoogleCloudPlatform/golang-samples

cloudsql: Add Postgres sample

Other Postgres samples have used https://github.com/lib/pq. Is there a reason for this to use a different package? In general, I'd prefer to be consistent.

From the documentation for pq: "This package is effectively in maintenance mode and is not actively developed. Small patches and features are only rarely reviewed and merged. We recommend using pgx which is actively maintained."

shubha-rajan

comment created time in a month

Pull request review commentGoogleCloudPlatform/golang-samples

cloudsql: update MySQL sample

 type templateData struct { 	RecentVotes []vote } -func main() {-	var err error+// app struct contains global state.+type app struct {+	// db is the global database connection pool.+	db *sql.DB+	// tmpl is the parsed HTML template.+	tmpl *template.Template+}++// indexHandler handles requests to the / route.+func (app *app) indexHandler(w http.ResponseWriter, r *http.Request) {+	switch r.Method {+	case "GET":+		if err := showTotals(w, r, app); err != nil {+			log.Printf("showTotals: %v", err)+			http.Error(w, "Internal Server Error", http.StatusInternalServerError)+		}+	case "POST":+		if err := saveVote(w, r, app); err != nil {+			log.Printf("saveVote: %v", err)+			http.Error(w, "Internal Server Error", http.StatusInternalServerError)+		}+	default:+		http.Error(w, fmt.Sprintf("HTTP Method %s Not Allowed", r.Method), http.StatusMethodNotAllowed)+	}+} -	parsedTemplate, err = template.ParseFiles("templates/index.html")+func main() {+	parsedTemplate, err := template.ParseFiles("templates/index.html") 	if err != nil { 		log.Fatalf("unable to parse template file: %s", err) 	} +	app := &app{+		tmpl: parsedTemplate,+	}+ 	// If the optional DB_TCP_HOST environment variable is set, it contains 	// the IP address and port number of a TCP connection pool to be created,-	// such as "127.0.0.1:3306". If DB_TCP_HOST is not set, a Unix socket+	// such as "127.0.0.1:1433". If DB_TCP_HOST is not set, a Unix socket

Yup. This was a mistake from copying that bit from another sample. Fixed.

shubha-rajan

comment created time in a month

Pull request review commentGoogleCloudPlatform/golang-samples

cloudsql: update MySQL sample

 for more details on connecting a Cloud Run service to Cloud SQL. gcloud builds submit --tag gcr.io/[YOUR_PROJECT_ID]/run-sql ``` -2. Deploy the service to Cloud Run:-+1. Make sure the following environment variables are set: ```sh-gcloud run deploy run-sql --image gcr.io/[YOUR_PROJECT_ID]/run-sql+export INSTANCE_CONNECTION_NAME='<MY-PROJECT>:<INSTANCE-REGION>:<INSTANCE-NAME>'+export DB_USER='<DB_USER_NAME>'+export DB_PASS='<DB_PASSWORD>'+export DB_NAME='<DB_NAME>' ``` -Take note of the URL output at the end of the deployment process.--3. Configure the service for use with Cloud Run+1. Deploy the service to Cloud Run:  ```sh-gcloud beta run services update run-sql \-    --add-cloudsql-instances [INSTANCE_CONNECTION_NAME] \-    --update-env-vars INSTANCE_CONNECTION_NAME=[INSTANCE_CONNECTION_NAME] \-    --update-env-vars DB_USER=[YOUR_DB_USER] \-    --update-env-vars DB_PASS=[YOUR_DB_PASS] \-    --update-env-vars DB_NAME=[YOUR_DB]+gcloud run deploy run-sql --image gcr.io/[YOUR_PROJECT_ID]/run-sql \+  --add-cloudsql-instances $INSTANCE_CONNECTION_NAME \+  --set-env-vars INSTANCE_CONNECTION_NAME=$INSTANCE_CONNECTION_NAME \+  --set-env-vars DB_USER=$DB_USER,DB_PASS=$DB_PASS,DB_NAME=$DB_NAME 

I figured that most users will have these variables exported already, so it would be easiest to just copy-paste the command as-is. I updated it to be inlined in the last commit.

shubha-rajan

comment created time in a month

push eventshubha-rajan/golang-samples

Shubha Rajan

commit sha c1080e7d964bab0fc6626ee85f236fa32e97f402

address PR comments

view details

push time in a month

PR opened GoogleCloudPlatform/golang-samples

Reviewers
cloudsql: update MySQL sample

Updated the MySQL sample for consistency with the SQL server sample. Also added the ability to override the default cloudsql Unix socket path with an environment variable.

+168 -107

0 comment

5 changed files

pr created time in a month

push eventshubha-rajan/golang-samples

Shubha Rajan

commit sha 280393a9d606678f06293fac754ed1b2b60749ed

update Cloud Run command in readme

view details

push time in a month

push eventshubha-rajan/golang-samples

Shubha Rajan

commit sha 06b9023349460fc2835209fd7958b69a65425804

update SQL commands

view details

push time in a month

create barnchshubha-rajan/golang-samples

branch : mysql-sample-update

created branch time in a month

push eventshubha-rajan/golang-samples

Tyler Bui-Palsulich

commit sha c9d21016c9acee66ec7fedf00c79674b97cd91f7

testing, .github: remove autoformat, move go vet to Actions (#1546)

view details

Chris Broadfoot

commit sha 7852be6582ed4086554bc1d6c1a46cbc36c89659

all: update deps (#1562) For each module: go get -d $(go list -m -f '{{if not .Indirect}}{{.Path}}{{end}}' all) go mod tidy

view details

push time in a month

issue commentGoogleCloudPlatform/java-docs-samples

Example for connecting from Cloud Run to Cloud Sql

Hi @safield, we currently have documentation here for how to form the a connection URL when connecting with Cloud Run: . We recommend using the Cloud SQL JDBC Socket Factory along with the recommended JDBC driver for your database engine. You also have the option of connecting using a Private IP address (currently in beta), and the steps to configure your application to do that are here. Examples for how to form a connection string given an IP address can be found in the documentation for your driver (for example, the connection info for Postgres is here).

If there's any specific information that's missing in the links above that you're looking for, please reply and we can work on updating our samples.

safield

comment created time in a month

push eventshubha-rajan/golang-samples

Shubha Rajan

commit sha 8baa25929c84b6dce7aa7698516c483d5462bd40

add instructions to deploy to GAE-Flex and Cloud Run

view details

push time in a month

PR opened GoogleCloudPlatform/golang-samples

cloudsql: Add Postgres sample

This is mostly copied from the existing SQL Server sample that was recently merged (#1390) but edited to use (pgx)[https://github.com/jackc/pgx] as a driver instead. Other changes include:

  • Allowing override of the default /cloudsql Unix socket path with an environment variable
  • Adding instructions to deploy to App Engine Flexible and Cloud Run
+872 -0

0 comment

8 changed files

pr created time in a month

push eventshubha-rajan/golang-samples

Shubha Rajan

commit sha 1f03a5d58e6f0008d68bc9e67a0981c685d660f6

add instructions to deploy to GAE-Flex and Cloud Run

view details

push time in a month

push eventshubha-rajan/golang-samples

Shubha Rajan

commit sha 065ba0d3db2a34dc1ea81cc7c14d361f4e602d4d

add instructions to deploy to GAE-Flex and Cloud Run

view details

push time in a month

push eventshubha-rajan/golang-samples

Shubha Rajan

commit sha c2a1cef5beae291d49b0c630748599418e4cb501

add instructions to deploy to GAE-Flex and Cloud Run

view details

push time in a month

create barnchshubha-rajan/golang-samples

branch : postgres-sample

created branch time in a month

push eventGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

WhiteSource Renovate

commit sha 57fbc5991dc6e5660f1deedb0e8ea2dd8685ee43

chore(deps): update dependency com.google.auth:google-auth-library-oauth2-http to v0.21.1 (#228)

view details

push time in a month

PR merged GoogleCloudPlatform/cloud-sql-jdbc-socket-factory

chore(deps): update dependency com.google.auth:google-auth-library-oauth2-http to v0.21.1

This PR contains the following updates:

Package Update Change
com.google.auth:google-auth-library-oauth2-http patch 0.21.0 -> 0.21.1

Renovate configuration

:date: Schedule: At any time (no schedule defined).

:vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.

:recycle: Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

:no_bell: Ignore: Close this PR and you won't be reminded about this update again.


  • [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

This PR has been generated by WhiteSource Renovate. View repository job log here.

+1 -1

0 comment

1 changed file

renovate-bot

pr closed time in a month

issue commentGoogleCloudPlatform/cloudsql-proxy

Confusing error message when hard rlimit for file descriptors is too low

Thanks for opening the issue, @mltsy. I agree that the "invalid argument" error isn't very helpful, and a more descriptive error message seems like a simple enough change. As for changing the default behavior, I'm not sure if that would break users or break functionality elsewhere.

@kurtisvg any thoughts on how to approach this?

mltsy

comment created time in a month

fork shubha-rajan/golang-samples

Sample apps and code written for Google Cloud in the Go programming language.

fork in a month

push eventGoogleCloudPlatform/php-docs-samples

John Pedrie

commit sha c31bd095c7cf752dec05e072ca5a404771644cfd

feat: refactor postgres sample to use slim app

view details

John Pedrie

commit sha abd5c7309abc68ce18d2e17089beb9f54dc8b1c5

replace MY-DATABASE with INSTANCE-NAME

view details

John Pedrie

commit sha f003fcae032b53e5f0b2acbc55005a5f740c7d20

fix style, use hostname for choosing tcp mode, add GAE standard docs

view details

John Pedrie

commit sha 4019b608ec5bded2f6b01735fbc69267d603bbe3

fix copyright and secret manager link

view details

John Pedrie

commit sha 76e3ec40ed2af702ec75d69c7df1d23ca749cddb

Update cloud_sql/postgres/pdo/README.md Co-authored-by: Kurtis Van Gent <31518063+kurtisvg@users.noreply.github.com>

view details

John Pedrie

commit sha a8e2788abd88f2d3059b46488588f9c271df3c39

fix conflict

view details

John Pedrie

commit sha 95e45d2417d3a93a4758db2a281613834a8ac7b6

Merge branch 'master' into cloudsql/postgres

view details

John Pedrie

commit sha 6dedd1074c65020d964bd369bb05cc5b2290d456

fix sample gae definition

view details

John Pedrie

commit sha c741d0129f645d0fe4d93ff57d0660207b3b8baa

address review

view details

John Pedrie

commit sha 1b728f5d567090b8556a50465cd68606c99486c8

Merge branch 'cloudsql/postgres' of github.com:jdpedrie/php-docs-samples into cloudsql/postgres

view details

John Pedrie

commit sha d52148de4ac638075134e6156f1412153fa4e05c

address review comments

view details

John Pedrie

commit sha 56325a1e68fe1c61d1224c1963538d80f76c8231

remove guzzle

view details

Shubha Rajan

commit sha 6f48414efface17d46c86563e63ea819724d24ab

Address review comments in README.md

view details

Shubha Rajan

commit sha 4c52fead98ed0fe8dfe712e7f8e065c9f9b4cb3e

Remove comment in app.flex.yaml

view details

Shubha Rajan

commit sha 0ea37947022571f9534df016eb4e8d34ff021291

Update README.md

view details

Shubha Rajan

commit sha 39a13e299f95150453123a1f3de452d2071f6d8a

Merge pull request #1099 from jdpedrie/cloudsql/postgres feat: refactor postgres sample to use slim app

view details

push time in a month

issue commentmicrosoft/mssql-jdbc

[FEATURE REQUEST] Accept connected sockets from custom socket factory

Hi @shubha-rajan, thanks for the suggestion. The fix looks simple, and we will test the changes and make a PR if no issues are found.

Thank you!

shubha-rajan

comment created time in a month

Pull request review commentGoogleCloudPlatform/php-docs-samples

feat: refactor postgres sample to use slim app

 $ php -S localhost:8080  Navigate towards http://localhost:8080 to verify your application is running correctly. +## Google App Engine Flex++To run on App Engine Flex, create an App Engine project by following the setup for these [instructions](https://cloud.google.com/appengine/docs/standard/php7/quickstart#before-you-begin).++First, update `app.flex.yaml` with the correct values to pass the environment variables into the runtime.++Then, make sure that the service account `service-{PROJECT_NUMBER}>@gae-api-prod.google.com.iam.gserviceaccount.com` has the IAM role `Cloud SQL Client`.++Next, the following command will deploy the application to your Google Cloud project:++```bash+$ gcloud beta app deploy

fixed

jdpedrie

comment created time in a month

Pull request review commentGoogleCloudPlatform/php-docs-samples

feat: refactor postgres sample to use slim app

 $ php -S localhost:8080  Navigate towards http://localhost:8080 to verify your application is running correctly. +## Google App Engine Flex++To run on App Engine Flex, create an App Engine project by following the setup for these [instructions](https://cloud.google.com/appengine/docs/standard/php7/quickstart#before-you-begin).++First, update `app.flex.yaml` with the correct values to pass the environment variables into the runtime.++Then, make sure that the service account `service-{PROJECT_NUMBER}>@gae-api-prod.google.com.iam.gserviceaccount.com` has the IAM role `Cloud SQL Client`.++Next, the following command will deploy the application to your Google Cloud project:++```bash+$ gcloud beta app deploy+```+ ## Google App Engine Standard -To run on GAE-Standard, create an App Engine project by following the setup for these [instructions](https://cloud.google.com/appengine/docs/standard/php7/quickstart#before-you-begin).+To run on App Engine Standard, create an App Engine project by following the setup for these [instructions](https://cloud.google.com/appengine/docs/standard/php7/quickstart#before-you-begin). -First, update `app.yaml` with the correct values to pass the environment variables into the runtime.+First, update `app-standard.yaml` with the correct values to pass the environment variables into the runtime.

fixed

jdpedrie

comment created time in a month

Pull request review commentGoogleCloudPlatform/php-docs-samples

feat: refactor postgres sample to use slim app

  ## Before you begin -1. Before you use this code sample, you need to have [Composer](https://getcomposer.org/) installed or downloaded into this folder. Download instructions can be found [here](https://getcomposer.org/download/).+1. Before you use this code sample, you need to have [Composer](https://getcomposer.org/) installed or downloaded into this folder. Download instructions can be found [here](https://getcomposer.org/download/). Once you've installed composer, use it to install required dependencies by running `composer install`. 2. Create a PostgreSQL Cloud SQL Instance by following these [instructions](https://cloud.google.com/sql/docs/postgres/create-instance). Note the connection string, database user, and database password that you create. 3. Create a database for your application by following these [instructions](https://cloud.google.com/sql/docs/postgres/create-manage-databases). Note the database name. 4. Create a service account with the 'Cloud SQL Client' permissions by following these [instructions](https://cloud.google.com/sql/docs/postgres/connect-external-app#4_if_required_by_your_authentication_method_create_a_service_account). Download a JSON key to use to authenticate your connection.-5. Use the information noted in the previous steps:++## Running Locally++To run this application locally, download and install the `cloud_sql_proxy` by following the instructions [here](https://cloud.google.com/sql/docs/postgres/sql-proxy#install).++To authenticate with Cloud SQL, set the `$GOOGLE_APPLICATION_CREDENTIALS` environment variable:  ```bash export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account/key.json-export CLOUD_SQL_CONNECTION_NAME='<MY-PROJECT>:<INSTANCE-REGION>:<MY-DATABASE>'-export DB_USER='my-db-user'-export DB_PASS='my-db-pass'-export DB_NAME='my-db-name'-export DB_HOSTNAME='localhost' # If connecting using TCP instead of Unix Sockets ``` -Note: Saving credentials in environment variables is convenient, but not secure - consider a more secure solution such as [Cloud KMS](https://cloud.google.com/kms/) to help keep secrets safe.+To run the Cloud SQL proxy, you need to set the instance connection name. See the instructions [here](https://cloud.google.com/sql/docs/postgres/quickstart-proxy-test#get_the_instance_connection_name) for finding the instance connection name. -## Running Locally+```bash+export CLOUD_SQL_CONNECTION_NAME='<MY-PROJECT>:<INSTANCE-REGION>:<INSTANCE-NAME>'+``` -To run this application locally, download and install the `cloud_sql_proxy` by following the instructions [here](https://cloud.google.com/sql/docs/postgres/sql-proxy#install).+Once the proxy is ready, use one of the following commands to start the proxy in the background. -Once the proxy is ready, use the following command to start the proxy in the background:+You may connect to your instance via either unix sockets or TCP. To connect using a socket, you must provide the `-dir` option when starting the proxy. To connect via TCP, you must provide a port as part of the instance name. Both are demonstrated below.++### Unix Socket mode  ```bash-$ ./cloud_sql_proxy -dir=/cloudsql --instances=$CLOUD_SQL_CONNECTION_NAME --credential_file=$GOOGLE_APPLICATION_CREDENTIALS+$ ./cloud_sql_proxy -dir=/cloudsql \+    --instances=$CLOUD_SQL_CONNECTION_NAME \+    --credential_file=$GOOGLE_APPLICATION_CREDENTIALS ```  Note: Make sure to run the command under a user with write access in the `/cloudsql` directory. This proxy will use this folder to create a unix socket the application will use to connect to Cloud SQL. +### TCP mode++```bash+$ ./cloud_sql_proxy \+    --instances=$CLOUD_SQL_CONNECTION_NAME=tcp:5432 \+    --credential_file=$GOOGLE_APPLICATION_CREDENTIALS+```++### Set Configuration Values++Set the required environment variables for your connection to Cloud SQL. If you are using TCP mode as described above, do not set the `CLOUD_SQL_CONNECTION_NAME` variable.

It should actually be

If you are using Unix socket mode as described above, do not set the DB_HOSTNAME variable.

The code should use TCP only if DB_HOSTNAME is set:

if ($hostname) {
            // Connect using TCP
            $dsn = sprintf('pgsql:dbname=%s;host=%s', $dbName, $hostname);
        } else {
            // Connect using UNIX sockets
            $dsn = sprintf(
                'pgsql:dbname=%s;host=/cloudsql/%s',

Updated this in the last set of commits

jdpedrie

comment created time in a month

push eventjdpedrie/php-docs-samples

Shubha Rajan

commit sha 0ea37947022571f9534df016eb4e8d34ff021291

Update README.md

view details

push time in a month

Pull request review commentGoogleCloudPlatform/php-docs-samples

feat: refactor postgres sample to use slim app

+<?php+/*+ * Copyright 2020 Google LLC.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ *     http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++declare(strict_types=1);++use Google\Cloud\Samples\CloudSQL\Postgres\Votes;+use Pimple\Container;+use Pimple\Psr11\Container as Psr11Container;+use Slim\Factory\AppFactory;+use Slim\Views\Twig;+use Slim\Views\TwigMiddleware;++// Create and set the dependency injection container.+$container = new Container;+AppFactory::setContainer(new Psr11Container($container));++// add the votes manager to the container.+$container['votes'] = function (Container $container) {+    return new Votes($container['db']);+};++// Setup the database connection in the container.+$container['db'] = function () {+    $username = getenv('DB_USER');+    $password = getenv('DB_PASS');+    $dbName = getenv('DB_NAME');+    $hostname = getenv('DB_HOSTNAME');

fixed (I changed the readme to use DB_HOSTNAME)

jdpedrie

comment created time in a month

Pull request review commentGoogleCloudPlatform/php-docs-samples

feat: refactor postgres sample to use slim app

 $ php -S localhost:8080  Navigate towards http://localhost:8080 to verify your application is running correctly. +## Google App Engine Flex++To run on App Engine Flex, create an App Engine project by following the setup for these [instructions](https://cloud.google.com/appengine/docs/standard/php7/quickstart#before-you-begin).++First, update `app.flex.yaml` with the correct values to pass the environment variables into the runtime.++Then, make sure that the service account `service-{PROJECT_NUMBER}>@gae-api-prod.google.com.iam.gserviceaccount.com` has the IAM role `Cloud SQL Client`.++Next, the following command will deploy the application to your Google Cloud project:++```bash+$ gcloud beta app deploy+```+ ## Google App Engine Standard

fixed

jdpedrie

comment created time in a month

Pull request review commentGoogleCloudPlatform/php-docs-samples

feat: refactor postgres sample to use slim app

+# Copyright 2020 Google LLC+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+#     http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.++runtime: php+env: flex++# Remember - storing secrets in plaintext is potentially unsafe. Consider using+# something like https://cloud.google.com/secret-manager/ to help keep secrets+# secret.+env_variables:+  CLOUD_SQL_CONNECTION_NAME: "<MY-PROJECT>:<INSTANCE-REGION>:<INSTANCE-NAME>"+  DB_USER: my-db-user+  DB_PASS: my-db-pass+  DB_NAME: my-db++beta_settings:+  cloud_sql_instances: "<MY-PROJECT>:<INSTANCE-REGION>:<INSTANCE-NAME>"++runtime_config:+  document_root: .++# Defaults to "serve index.php" and "serve public/index.php". Can be used to+# serve a custom PHP front controller (e.g. "serve backend/index.php") or to+# run a long-running PHP script as a worker process (e.g. "php worker.php").+#+# entrypoint: serve index.php

fixed

jdpedrie

comment created time in a month

Pull request review commentGoogleCloudPlatform/php-docs-samples

feat: refactor postgres sample to use slim app

  ## Before you begin -1. Before you use this code sample, you need to have [Composer](https://getcomposer.org/) installed or downloaded into this folder. Download instructions can be found [here](https://getcomposer.org/download/).+1. Before you use this code sample, you need to have [Composer](https://getcomposer.org/) installed or downloaded into this folder. Download instructions can be found [here](https://getcomposer.org/download/). Once you've installed composer, use it to install required dependencies by running `composer install`. 2. Create a PostgreSQL Cloud SQL Instance by following these [instructions](https://cloud.google.com/sql/docs/postgres/create-instance). Note the connection string, database user, and database password that you create. 3. Create a database for your application by following these [instructions](https://cloud.google.com/sql/docs/postgres/create-manage-databases). Note the database name. 4. Create a service account with the 'Cloud SQL Client' permissions by following these [instructions](https://cloud.google.com/sql/docs/postgres/connect-external-app#4_if_required_by_your_authentication_method_create_a_service_account). Download a JSON key to use to authenticate your connection.-5. Use the information noted in the previous steps:++## Running Locally++To run this application locally, download and install the `cloud_sql_proxy` by following the instructions [here](https://cloud.google.com/sql/docs/postgres/sql-proxy#install).++To authenticate with Cloud SQL, set the `$GOOGLE_APPLICATION_CREDENTIALS` environment variable:  ```bash export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account/key.json-export CLOUD_SQL_CONNECTION_NAME='<MY-PROJECT>:<INSTANCE-REGION>:<MY-DATABASE>'-export DB_USER='my-db-user'-export DB_PASS='my-db-pass'-export DB_NAME='my-db-name'-export DB_HOSTNAME='localhost' # If connecting using TCP instead of Unix Sockets ``` -Note: Saving credentials in environment variables is convenient, but not secure - consider a more secure solution such as [Cloud KMS](https://cloud.google.com/kms/) to help keep secrets safe.+To run the Cloud SQL proxy, you need to set the instance connection name. See the instructions [here](https://cloud.google.com/sql/docs/postgres/quickstart-proxy-test#get_the_instance_connection_name) for finding the instance connection name. -## Running Locally+```bash+export CLOUD_SQL_CONNECTION_NAME='<MY-PROJECT>:<INSTANCE-REGION>:<INSTANCE-NAME>'+``` -To run this application locally, download and install the `cloud_sql_proxy` by following the instructions [here](https://cloud.google.com/sql/docs/postgres/sql-proxy#install).+Once the proxy is ready, use one of the following commands to start the proxy in the background. -Once the proxy is ready, use the following command to start the proxy in the background:+You may connect to your instance via either unix sockets or TCP. To connect using a socket, you must provide the `-dir` option when starting the proxy. To connect via TCP, you must provide a port as part of the instance name. Both are demonstrated below.++### Unix Socket mode  ```bash-$ ./cloud_sql_proxy -dir=/cloudsql --instances=$CLOUD_SQL_CONNECTION_NAME --credential_file=$GOOGLE_APPLICATION_CREDENTIALS+$ ./cloud_sql_proxy -dir=/cloudsql \+    --instances=$CLOUD_SQL_CONNECTION_NAME \+    --credential_file=$GOOGLE_APPLICATION_CREDENTIALS ```  Note: Make sure to run the command under a user with write access in the `/cloudsql` directory. This proxy will use this folder to create a unix socket the application will use to connect to Cloud SQL.

That would make sense here, but in PR #1130 we're making it possible to override this default with an environment variable, and that's going to be the standard across languages for this sample.

jdpedrie

comment created time in a month

Pull request review commentGoogleCloudPlatform/php-docs-samples

feat: refactor postgres sample to use slim app

+<?php+/*+ * Copyright 2020 Google LLC.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ *     http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++declare(strict_types=1);++use Google\Cloud\Samples\CloudSQL\Postgres\Votes;+use Pimple\Container;+use Pimple\Psr11\Container as Psr11Container;+use Slim\Factory\AppFactory;+use Slim\Views\Twig;+use Slim\Views\TwigMiddleware;++// Create and set the dependency injection container.+$container = new Container;+AppFactory::setContainer(new Psr11Container($container));++// add the votes manager to the container.+$container['votes'] = function (Container $container) {+    return new Votes($container['db']);+};++// Setup the database connection in the container.+$container['db'] = function () {+    $username = getenv('DB_USER');+    $password = getenv('DB_PASS');+    $dbName = getenv('DB_NAME');+    $hostname = getenv('DB_HOSTNAME');+    $cloud_sql_connection_name = getenv('CLOUD_SQL_CONNECTION_NAME');++    try {+        // # [START cloud_sql_postgres_pdo_create]+        // // $username = 'your_db_user';+        // // $password = 'yoursupersecretpassword';+        // // $dbName = 'your_db_name';+        // // $cloud_sql_connection_name = getenv("CLOUD_SQL_CONNECTION_NAME");+        // // $hostname = "127.0.0.1"; // Only used in TCP mode.++        if ($hostname) {+            // Connect using TCP+            $dsn = sprintf('pgsql:dbname=%s;host=%s', $dbName, $hostname);+        } else {+            // Connect using UNIX sockets+            $dsn = sprintf(+                'pgsql:dbname=%s;host=/cloudsql/%s',

I believe /cloudsql is the default because it's the path that's expected by App Engine. In #1130 we added the ability to override the default path by setting an environment variable.

jdpedrie

comment created time in a month

push eventjdpedrie/php-docs-samples

Shubha Rajan

commit sha 4c52fead98ed0fe8dfe712e7f8e065c9f9b4cb3e

Remove comment in app.flex.yaml

view details

push time in a month

push eventjdpedrie/php-docs-samples

Shubha Rajan

commit sha 6f48414efface17d46c86563e63ea819724d24ab

Address review comments in README.md

view details

push time in a month

issue openedmicrosoft/mssql-jdbc

[FEATURE REQUEST] Accept connected sockets from custom socket factory

Is your feature request related to a problem? If so, please give a short summary of the problem and how the feature would resolve it

Currently, when using a custom socket factory that returns a connected socket, a SocketException is thrown because the getConnectedSocket method in IOBuffer.java will attempt to connect without checking whether the socket is already connected.

Describe the preferred solution

Check whether a socket is connected before attempting to connect to it in getConnectedSocket. See the corresponding code in the Postgres JDBC driver for reference

Additional context

This change would allow for compatibility with the Cloud SQL JDBC Socket Factory.

created time in a month

push eventGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Shubha Rajan

commit sha 6b67a1a42a3cce8fa605794c48b6dae4ac0e0d9a

Update User Agent methods and format (#225) * add user agent strings from connectors, update setApplicationName logic to append to string * use .properties to set user agent string using POM version and artifactId * moved setting user agent string to static block, remove system property * rename path to project.properties file, get version from CoreSocketFactory * change userAgent to list of userAgents in core, remove project.properties in connectors * check if added user agent is already in list * add default version in CoreSocketFactory

view details

push time in a month

delete branch GoogleCloudPlatform/cloud-sql-jdbc-socket-factory

delete branch : update-user-agent

delete time in a month

PR merged GoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Reviewers
Update User Agent methods and format

Change Description

Updated the SocketFactory classes to set the user agent in CoreSocketFactory so that it is specific to the connector. Also updated the logic in CoreSocketFactory.setApplicationName to append to the existing user agent string if it has already been set, allowing third party tools like spring-cloud-gcp to add custom names.

Checklist

  • [ ] Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea.
  • [ ] Ensure the tests and linter pass
  • [ ] Appropriate documentation is updated (if necessary)

Relevant issues:

  • Fixes #219
+64 -10

7 comments

7 changed files

shubha-rajan

pr closed time in a month

issue closedGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Update UserAgent format for usage metrics

UserAgent should be in the format of "[tool-name]/[version]"

For example:

USER_AGENT_PROPERTY_NAME = "mysql-socket-factory-connector-j-8/1.0.15";

closed time in a month

jsimonweb

create barnchshubha-rajan/python-docs-samples

branch : add-testing-cloudsql

created branch time in a month

Pull request review commentGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Update User Agent methods and format

 private static KeyPair generateRsaKeyPair() {     return generator.generateKeyPair();   } +  private static String getVersion() {+    try {+      Properties packageInfo = new Properties();+      packageInfo.load(CoreSocketFactory.class.getClassLoader().getResourceAsStream(+          "com.google.cloud.sql/project.properties"));+      return packageInfo.getProperty("version");

fixed

shubha-rajan

comment created time in a month

push eventGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Shubha Rajan

commit sha 7847c84fa799ab6bbfdfdc790988a6ce5f280af4

add default version in CoreSocketFactory

view details

push time in a month

Pull request review commentGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Update User Agent methods and format

 private static KeyPair generateRsaKeyPair() {     return generator.generateKeyPair();   } +  /** Sets the default string which is appended to the SQLAdmin API client User-Agent header. */+  public static void addUserAgent(String artifactId) {+    if (version != null) {+      userAgents.add(artifactId + "/" + version);+    } else {+      userAgents.add(artifactId);+    }+  }++  /** Returns the default string which is appended to the SQLAdmin API client User-Agent header. */+  public static String getUserAgentString() {+    return String.join(" ", userAgents);

Never mind, changed this to append the application name in the latest set of commits

shubha-rajan

comment created time in a month

push eventGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Shubha Rajan

commit sha 9e4f4c6b73c8591cbc83538609301dacdc96b315

append application name in getUserAgents

view details

push time in a month

Pull request review commentGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Update User Agent methods and format

 private static KeyPair generateRsaKeyPair() {     return generator.generateKeyPair();   } +  /** Sets the default string which is appended to the SQLAdmin API client User-Agent header. */+  public static void addUserAgent(String artifactId) {

fixed

shubha-rajan

comment created time in a month

push eventGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Shubha Rajan

commit sha d7d58761e03b738c9768e68131d168fc3375aeac

rename addUserAgent to addArtifactId

view details

push time in a month

push eventGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Shubha Rajan

commit sha 88898e41be5075556e1554e82681bdf3b4ac4992

make getUserAgents private

view details

push time in a month

push eventGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Shubha Rajan

commit sha 680f98e09f8029a9dfb2e5db52299ffb86377dc1

rename getUserAgentString to getUserAgents

view details

push time in a month

Pull request review commentGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Update User Agent methods and format

 private static KeyPair generateRsaKeyPair() {     return generator.generateKeyPair();   } +  /** Sets the default string which is appended to the SQLAdmin API client User-Agent header. */+  public static void addUserAgent(String artifactId) {+    if (version != null) {+      userAgents.add(artifactId + "/" + version);+    } else {+      userAgents.add(artifactId);+    }+  }++  /** Returns the default string which is appended to the SQLAdmin API client User-Agent header. */+  public static String getUserAgentString() {+    return String.join(" ", userAgents);

Not sure. Right now I'm inlining combining the two strings when creating the SQLAdmin API client.

shubha-rajan

comment created time in a month

Pull request review commentGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Update User Agent methods and format

+version=${project.version}

fixed

shubha-rajan

comment created time in a month

Pull request review commentGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Update User Agent methods and format

 private static KeyPair generateRsaKeyPair() {     return generator.generateKeyPair();   } +  /** Sets the default string which is appended to the SQLAdmin API client User-Agent header. */+  public static void addUserAgent(String artifactId) {+    if (version != null) {+      userAgents.add(artifactId + "/" + version);+    } else {+      userAgents.add(artifactId);+    }+  }++  /** Returns the default string which is appended to the SQLAdmin API client User-Agent header. */+  public static String getUserAgentString() {+    return String.join(" ", userAgents);+  }++  /** Returns the current User-Agent header set for the underlying SQLAdmin API client. */+  public static String getApplicationName() {+    if (coreSocketFactory != null) {+      return coreSocketFactory.adminApi.getApplicationName();+    }+    return System.getProperty(USER_TOKEN_PROPERTY_NAME, "");

Should it? I wasn't sure if it should return the whole string, or just the string set in setApplicationName

shubha-rajan

comment created time in a month

Pull request review commentGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Update User Agent methods and format

 private static KeyPair generateRsaKeyPair() {     return generator.generateKeyPair();   } +  /** Sets the default string which is appended to the SQLAdmin API client User-Agent header. */+  public static void addUserAgent(String artifactId) {+    if (version != null) {+      userAgents.add(artifactId + "/" + version);

it's defaulted to "unknown" in the latest commit

shubha-rajan

comment created time in a month

Pull request review commentGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Update User Agent methods and format

   private final SQLAdmin adminApi;   private final int serverProxyPort; +  private static List<String> userAgents = new ArrayList<String>();+  private static String version;++  static {+    try {+      Properties packageInfo = new Properties();

moved to separate function in latest commit

shubha-rajan

comment created time in a month

Pull request review commentGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Update User Agent methods and format

    private Socket socket; +  private static final String DEFAULT_APPLICATION_NAME = "mysql-socket-factory-connector-j-5";++  static {+    CoreSocketFactory.addUserAgent(DEFAULT_APPLICATION_NAME);

fixed

shubha-rajan

comment created time in a month

push eventGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Shubha Rajan

commit sha 223a6eea971440f311aa12fcec953b5f269f3723

inline connector name

view details

Shubha Rajan

commit sha b677b916f2114995e759c39351e8620ae84cfd56

check if added user agent is already in list

view details

push time in a month

pull request commentGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Update User Agent methods and format

  1. Can we use load packageInfo in as a static private field as well?
  2. What happens if the user uses both MySQL and Postgres? Maybe we should maintain a list of UserAgent's that should be used?
  3. I also think we may need to consider to take care with the name - maybe addUserAgent, to avoid conflicting with setApplicationName? thoughts?

I think addUserAgent would make sense if we're maintaining a list of user agents. So then when any of the connectors are loaded into memory, the user agent would be added to the list of user agents. I made some changes to incorporate that in the last commit.

I do have a few questions:

  1. If the user is using both MySQL and Postgres, the user agents are added as soon as the connector classes are loaded because of the static block, right? so then any call to connect would have both user agents, regardless of which connector is making the call. Is this what we want?
  2. Since CoreSocketFactory (and the SQLAdminApi client) is instantiated after the first connect call, is it possible that a user using both MySQL and Postgres would instantiate the SQLAdminAPI before both classes are loaded into memory and both user agents are added?
  3. What's the behavior we want for setApplicationName? This is used by external apps to add their own user agent. Would it make more sense for this string to be stored in a separate variable (so that multiple calls would overwrite it) or should it be appended to the userAgents list?
shubha-rajan

comment created time in 2 months

push eventGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Shubha Rajan

commit sha e8010f8caabbc76192515110e1973bd471ec868d

change userAgent to list of userAgents in core, remove project.properties in connectors

view details

push time in 2 months

push eventGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Shubha Rajan

commit sha f8c883fe8717b6309c089f7704e67516dc72f06a

rename path to project.properties file, get version from CoreSocketFactory

view details

push time in 2 months

push eventGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Shubha Rajan

commit sha 421be345c4ff926e00abd549829da0517dc83805

moved setting user agent string to static block, remove system property

view details

push time in 2 months

Pull request review commentGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Update User Agent methods and format

 private static SQLAdmin createAdminApiClient(HttpRequestInitializer requestIniti     JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();     SQLAdmin.Builder adminApiBuilder =         new Builder(httpTransport, jsonFactory, requestInitializer)-            .setApplicationName(getApplicationName());+            .setApplicationName(+                String.format("%s %s", getDefaultUserAgent(), getApplicationName()));

I'll probably get rid of the getDefaultUserAgent method in the next commit though, since we don't need to set a system property. In that case I'll handle if the connector name is null.

shubha-rajan

comment created time in 2 months

Pull request review commentGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Update User Agent methods and format

 private static SQLAdmin createAdminApiClient(HttpRequestInitializer requestIniti     JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();     SQLAdmin.Builder adminApiBuilder =         new Builder(httpTransport, jsonFactory, requestInitializer)-            .setApplicationName(getApplicationName());+            .setApplicationName(+                String.format("%s %s", getDefaultUserAgent(), getApplicationName()));

so right now, getDefaultUserAgent defaults to "cloud-sql-java-connector" and getApplicationName defaults to an empty string. So there shouldn't be any cases of either of those returning null.

shubha-rajan

comment created time in 2 months

Pull request review commentGoogleCloudPlatform/cloud-sql-jdbc-socket-factory

Update User Agent methods and format

    private Socket socket; +  private static final String APPLICATION_NAME = "mysql-socket-factory-connector-j-5";++  private static String getUserAgentString() {+    try {+      Properties packageInfo = new Properties();+      packageInfo+          .load(SocketFactory.class.getClassLoader().getResourceAsStream("project.properties"));

I tried that earlier but kept getting null values for the version. From looking it up, I gathered it was because Maven jar builds don't include that information in the jar manifest by default. I added a config option to the parent pom.xml which added that metadata to the jar, but it still showed up as null when getting the value.

shubha-rajan

comment created time in 2 months

more