-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathappengine.apps.modules.versions.create.snippet.json
1 lines (1 loc) · 6.64 KB
/
appengine.apps.modules.versions.create.snippet.json
1
{"metadata":{"apiName":"appengine","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"Java":"// Autogenerated example code for appengine.apps.modules.versions.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable appengine Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/appengine/quotas \r\n// 2. To install the client library on maven or gradle, check installation instructions at \r\n// https://github.com/google/google-api-java-client. \r\n// On other build systems, you can add the jar files to your project from \r\n// https://developers.google.com/resources/api-libraries/download/appengine/v1beta4/java\r\n// 3. This sample uses Application Default Credentials for Auth. If not already done, install gcloud CLI from \r\n// https://cloud.google.com/sdk/ and run 'gcloud auth login'\r\n\r\nimport com.google.api.client.googleapis.auth.oauth2.GoogleCredential;\r\nimport com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;\r\nimport com.google.api.client.http.HttpTransport;\r\nimport com.google.api.client.json.JsonFactory;\r\nimport com.google.api.client.json.jackson2.JacksonFactory;\r\nimport com.google.api.services.appengine.Appengine;\r\nimport com.google.api.services.appengine.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class AppengineSample {\r\n\tpublic static void main(String[] args) throws IOException, GeneralSecurityException {\r\n\t\t// Authentication is provided by gcloud tool when running locally\r\n\t\t// and by built-in service accounts when running on GAE, GCE or GKE.\r\n\t\tGoogleCredential credential = GoogleCredential.getApplicationDefault();\r\n\t\t\t \r\n\t\t// The createScopedRequired method returns true when running on GAE or a local developer\r\n\t\t// machine. In that case, the desired scopes must be passed in manually. When the code is\r\n\t\t// running in GCE, GKE or a Managed VM, the scopes are pulled from the GCE metadata server.\r\n\t\t// See https://developers.google.com/identity/protocols/application-default-credentials for more information.\r\n\t\tif (credential.createScopedRequired()) {\r\n\t\t\tcredential = credential.createScoped(Collections.singletonList(\"https://www.googleapis.com/auth/cloud-platform\"));\r\n\t\t}\r\n\t\t\t\t\r\n\t\tHttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();\r\n\t\tJsonFactory jsonFactory = JacksonFactory.getDefaultInstance(); \r\n\t\tAppengine appengineService = new Appengine.Builder(httpTransport, jsonFactory, credential)\r\n\t\t\t.setApplicationName(\"Google Cloud Platform Sample\")\r\n\t\t\t.build();\r\n\r\n\t\tVersion version = new Version();\r\n\t\t// Add your code to populate the version object\r\n\t\tAppengine.Apps.Modules.Versions.Create call = appengineService.apps().modules().versions().create(\"example-appsId\", \"example-modulesId\", version);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","Python":"# Autogenerated example code for appengine.apps.modules.versions.create\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable appengine Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/appengine/quotas \r\n# 2. Install python client library for Google APIs using 'pip install --upgrade google-api-python-client'.\r\n# 3. This sample uses Application Default Credentials for Auth. If not already done, install gcloud CLI from \r\n# https://cloud.google.com/sdk/ and run 'gcloud auth login'\r\n\r\n\r\nfrom apiclient import discovery\r\nfrom oauth2client.client import GoogleCredentials\r\nimport json\r\n\r\n# Authentication is provided by gcloud tool when running locally\r\n# and by built-in service accounts when running on GAE, GCE or GKE.\r\n# See https://developers.google.com/identity/protocols/application-default-credentials\r\n# for more information.\r\ncredentials = GoogleCredentials.get_application_default()\r\n\r\n# Construct the service object for interacting with the Compute API -\r\n# the 'appengine' service, at version 'v1beta4'.\r\n# You can browse other available api services and versions here:\r\n# https://developers.google.com/api-client-library/python/apis/\r\nservice = discovery.build('appengine', 'v1beta4', credentials=credentials)\r\n\r\nversion = {} # construct your object here\r\nrequest = service.apps().modules().versions().create(body=version, appsId=\"example-appsId\", modulesId=\"example-modulesId\")\r\nrequest.execute()","Go":null,"NodeJs":null,"C#":"// Autogenerated example code for appengine.apps.modules.versions.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable appengine Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/appengine/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.appengine.v1beta4\r\n// 3. This sample uses Application Default Credentials for Auth. If not already done, install gcloud CLI from \r\n// https://cloud.google.com/sdk/ and run 'gcloud auth login'\r\n\r\nusing Google.Apis.Appengine.v1beta4;\r\nusing Google.Apis.Appengine.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass AppengineSample\r\n{\r\n static void Main()\r\n {\r\n // Authentication is provided by gcloud tool when running locally\r\n // and by built-in service accounts when running on GAE, GCE or GKE.\r\n GoogleCredential credential = GoogleCredential.GetApplicationDefaultAsync().Result;\r\n\r\n // The createScopedRequired method returns true when running on GAE or a local developer\r\n // machine. In that case, the desired scopes must be passed in manually. When the code is\r\n // running in GCE, GKE or a Managed VM, the scopes are pulled from the GCE metadata server.\r\n // See https://developers.google.com/identity/protocols/application-default-credentials for more information.\r\n if (credential.IsCreateScopedRequired)\r\n {\r\n credential = credential.CreateScoped(new[] { \"https://www.googleapis.com/auth/cloud-platform\" });\r\n }\r\n\r\n var appengineService = new AppengineService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var version = new Version();\r\n // Add your code to populate the version object\r\n var call = appengineService.Apps.Modules.Versions.Create(version, \"example-appsId\", \"example-modulesId\");\r\n var response = call.Execute();\r\n }\r\n}","Ruby":null,"PHP":null}}