This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = require('request'); | |
const log4js = require("log4js"); | |
const jwt = require('jsonwebtoken'); | |
const logger = log4js.getLogger(); | |
const secure_IAAP_URL = 'https://YOUR_PROTECTED_PAGE'; | |
const iap_clientID = 'client_id_for_iaap.apps.googleusercontent.com'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JacksonFactory jsonFactory = new JacksonFactory(); | |
HttpHost proxy = new HttpHost("127.0.0.1",3128); | |
DefaultHttpClient httpClient = new DefaultHttpClient(); | |
httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); | |
httpClient.addRequestInterceptor(new HttpRequestInterceptor(){ | |
@Override | |
public void process(org.apache.http.HttpRequest request, HttpContext context) throws HttpException, IOException { | |
if (request.getRequestLine().getMethod().equals("CONNECT")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
com.google.api.client.googleapis.auth.oauth2.GoogleCredential credential = com.google.api.client.googleapis.auth.oauth2.GoogleCredential.getApplicationDefault(mHttpTransport,jsonFactory); | |
if (credential.createScopedRequired()) | |
credential = credential.createScoped(Arrays.asList(StorageScopes.DEVSTORAGE_READ_ONLY)); | |
com.google.api.services.storage.Storage service = new com.google.api.services.storage.Storage.Builder(mHttpTransport, jsonFactory, credential) | |
.setApplicationName("oauth client") | |
.build(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HttpTransportFactory hf = new HttpTransportFactory(){ | |
@Override | |
public HttpTransport create() { | |
return mHttpTransport; | |
} | |
}; | |
com.google.auth.oauth2.GoogleCredentials credential = com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(hf); | |
if (credential.createScopedRequired()) | |
credential = credential.createScoped(Arrays.asList("https://www.googleapis.com/auth/devstorage.read_write")); | |
TransportOptions options = HttpTransportOptions.newBuilder().setHttpTransportFactory(hf).build(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"log" | |
"cloud.google.com/go/storage" | |
"cloud.google.com/go/pubsub" | |
"golang.org/x/net/context" | |
"google.golang.org/api/iterator" | |
) | |
const ( | |
projectID = "your_project" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string CREDENTIAL_FILE_PKCS12 = "/path/to/your/service0-account.p12"; | |
string serviceAccountEmail = "[email protected]"; | |
var certificate = new X509Certificate2(CREDENTIAL_FILE_PKCS12, "notasecret",X509KeyStorageFlags.Exportable); | |
ServiceAccountCredential credential = new ServiceAccountCredential( | |
new ServiceAccountCredential.Initializer(serviceAccountEmail) | |
{ | |
//Scopes = new[] { StorageService.Scope.DevstorageReadOnly, PublisherClient.DefaultScopes }, | |
Scopes = PublisherClient.DefaultScopes.Append(StorageService.Scope.DevstorageReadOnly), | |
HttpClientFactory = new ProxySupportedHttpClientFactory() | |
}.FromCertificate(certificate)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var log4js = require("log4js"); | |
var logger = log4js.getLogger(); | |
const Pubsub = require('@google-cloud/pubsub'); | |
var gcloud = require('google-cloud'); | |
var gcs = gcloud.storage(); | |
gcs.getBuckets(function(err, buckets) { | |
if (!err) { | |
buckets.forEach(function(value){ | |
logger.info(value.id); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System.setProperty("https.proxyHost", "localhost"); | |
System.setProperty("https.proxyPort", "3128"); | |
Authenticator.setDefault( | |
new Authenticator() { | |
@Override | |
public PasswordAuthentication getPasswordAuthentication() { | |
return new PasswordAuthentication( | |
"user1", "user1".toCharArray()); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"io/ioutil" | |
"log" | |
"net/http" | |
"net/url" | |
"strings" | |
"crypto/rsa" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gcloud deployment-manager deployments create yy60 --config cluster.yaml | |
NAME TYPE STATE ERRORS INTENT | |
yy60-cluster-as compute.v1.regionAutoscaler COMPLETED [] | |
yy60-cluster-beb compute.beta.backendBucket COMPLETED [] | |
yy60-cluster-bes compute.v1.backendService COMPLETED [] | |
yy60-cluster-config runtimeconfig.v1beta1.config COMPLETED [] | |
yy60-cluster-firewall-80 compute.v1.firewall COMPLETED [] | |
yy60-cluster-hc-http compute.v1.httpHealthCheck COMPLETED [] | |
yy60-cluster-igm compute.v1.regionInstanceGroupManager COMPLETED [] | |
yy60-cluster-it compute.v1.instanceTemplate COMPLETED [] |