From 390de18b61d10719ce67fa0597cf235dd68c2fd0 Mon Sep 17 00:00:00 2001 From: "vsubramani@google.com" Date: Sun, 14 Feb 2016 10:17:00 -0800 Subject: [PATCH] Initial Commit Initial Commit --- appengine.apps.get.snippet.json | 1 + appengine.apps.modules.delete.snippet.json | 1 + appengine.apps.modules.get.snippet.json | 1 + appengine.apps.modules.list.snippet.json | 1 + appengine.apps.modules.patch.snippet.json | 1 + appengine.apps.modules.versions.create.snippet.json | 1 + appengine.apps.modules.versions.delete.snippet.json | 1 + appengine.apps.modules.versions.get.snippet.json | 1 + appengine.apps.modules.versions.list.snippet.json | 1 + appengine.apps.operations.get.snippet.json | 1 + appengine.apps.operations.list.snippet.json | 1 + autoscaler.autoscalers.delete.snippet.json | 1 + autoscaler.autoscalers.get.snippet.json | 1 + autoscaler.autoscalers.insert.snippet.json | 1 + autoscaler.autoscalers.list.snippet.json | 1 + autoscaler.autoscalers.patch.snippet.json | 1 + autoscaler.autoscalers.update.snippet.json | 1 + autoscaler.zoneOperations.delete.snippet.json | 1 + autoscaler.zoneOperations.get.snippet.json | 1 + autoscaler.zoneOperations.list.snippet.json | 1 + autoscaler.zones.list.snippet.json | 1 + bigquery.datasets.delete.snippet.json | 1 + bigquery.datasets.get.snippet.json | 1 + bigquery.datasets.insert.snippet.json | 1 + bigquery.datasets.list.snippet.json | 1 + bigquery.datasets.patch.snippet.json | 1 + bigquery.datasets.update.snippet.json | 1 + bigquery.jobs.cancel.snippet.json | 1 + bigquery.jobs.get.snippet.json | 1 + bigquery.jobs.getQueryResults.snippet.json | 1 + bigquery.jobs.insert.snippet.json | 1 + bigquery.jobs.list.snippet.json | 1 + bigquery.jobs.query.snippet.json | 1 + bigquery.projects.list.snippet.json | 1 + bigquery.tabledata.insertAll.snippet.json | 1 + bigquery.tabledata.list.snippet.json | 1 + bigquery.tables.delete.snippet.json | 1 + bigquery.tables.get.snippet.json | 1 + bigquery.tables.insert.snippet.json | 1 + bigquery.tables.list.snippet.json | 1 + bigquery.tables.patch.snippet.json | 1 + bigquery.tables.update.snippet.json | 1 + cloudbilling.billingAccounts.get.snippet.json | 1 + cloudbilling.billingAccounts.list.snippet.json | 1 + cloudbilling.billingAccounts.projects.list.snippet.json | 1 + cloudbilling.projects.getBillingInfo.snippet.json | 1 + cloudbilling.projects.updateBillingInfo.snippet.json | 1 + clouddebugger.controller.debuggees.breakpoints.list.snippet.json | 1 + ...debugger.controller.debuggees.breakpoints.update.snippet.json | 1 + clouddebugger.controller.debuggees.register.snippet.json | 1 + clouddebugger.debugger.debuggees.breakpoints.delete.snippet.json | 1 + clouddebugger.debugger.debuggees.breakpoints.get.snippet.json | 1 + clouddebugger.debugger.debuggees.breakpoints.list.snippet.json | 1 + clouddebugger.debugger.debuggees.breakpoints.set.snippet.json | 1 + clouddebugger.debugger.debuggees.list.snippet.json | 1 + cloudmonitoring.metricDescriptors.create.snippet.json | 1 + cloudmonitoring.metricDescriptors.delete.snippet.json | 1 + cloudmonitoring.metricDescriptors.list.snippet.json | 1 + cloudmonitoring.timeseries.list.snippet.json | 1 + cloudmonitoring.timeseries.write.snippet.json | 1 + cloudmonitoring.timeseriesDescriptors.list.snippet.json | 1 + cloudresourcemanager.organizations.get.snippet.json | 1 + cloudresourcemanager.organizations.getIamPolicy.snippet.json | 1 + cloudresourcemanager.organizations.list.snippet.json | 1 + cloudresourcemanager.organizations.setIamPolicy.snippet.json | 1 + ...resourcemanager.organizations.testIamPermissions.snippet.json | 1 + cloudresourcemanager.organizations.update.snippet.json | 1 + cloudresourcemanager.projects.create.snippet.json | 1 + cloudresourcemanager.projects.delete.snippet.json | 1 + cloudresourcemanager.projects.get.snippet.json | 1 + cloudresourcemanager.projects.getIamPolicy.snippet.json | 1 + cloudresourcemanager.projects.list.snippet.json | 1 + cloudresourcemanager.projects.setIamPolicy.snippet.json | 1 + cloudresourcemanager.projects.testIamPermissions.snippet.json | 1 + cloudresourcemanager.projects.undelete.snippet.json | 1 + cloudresourcemanager.projects.update.snippet.json | 1 + cloudtrace.projects.patchTraces.snippet.json | 1 + cloudtrace.projects.traces.get.snippet.json | 1 + cloudtrace.projects.traces.list.snippet.json | 1 + clouduseraccounts.globalAccountsOperations.delete.snippet.json | 1 + clouduseraccounts.globalAccountsOperations.get.snippet.json | 1 + clouduseraccounts.globalAccountsOperations.list.snippet.json | 1 + clouduseraccounts.groups.addMember.snippet.json | 1 + clouduseraccounts.groups.delete.snippet.json | 1 + clouduseraccounts.groups.get.snippet.json | 1 + clouduseraccounts.groups.insert.snippet.json | 1 + clouduseraccounts.groups.list.snippet.json | 1 + clouduseraccounts.groups.removeMember.snippet.json | 1 + clouduseraccounts.linux.getAuthorizedKeysView.snippet.json | 1 + clouduseraccounts.linux.getLinuxAccountViews.snippet.json | 1 + clouduseraccounts.users.addPublicKey.snippet.json | 1 + clouduseraccounts.users.delete.snippet.json | 1 + clouduseraccounts.users.get.snippet.json | 1 + clouduseraccounts.users.insert.snippet.json | 1 + clouduseraccounts.users.list.snippet.json | 1 + clouduseraccounts.users.removePublicKey.snippet.json | 1 + compute.addresses.aggregatedList.snippet.json | 1 + compute.addresses.delete.snippet.json | 1 + compute.addresses.get.snippet.json | 1 + compute.addresses.insert.snippet.json | 1 + compute.addresses.list.snippet.json | 1 + compute.autoscalers.aggregatedList.snippet.json | 1 + compute.autoscalers.delete.snippet.json | 1 + compute.autoscalers.get.snippet.json | 1 + compute.autoscalers.insert.snippet.json | 1 + compute.autoscalers.list.snippet.json | 1 + compute.autoscalers.patch.snippet.json | 1 + compute.autoscalers.update.snippet.json | 1 + compute.backendServices.delete.snippet.json | 1 + compute.backendServices.get.snippet.json | 1 + compute.backendServices.getHealth.snippet.json | 1 + compute.backendServices.insert.snippet.json | 1 + compute.backendServices.list.snippet.json | 1 + compute.backendServices.patch.snippet.json | 1 + compute.backendServices.update.snippet.json | 1 + compute.diskTypes.aggregatedList.snippet.json | 1 + compute.diskTypes.get.snippet.json | 1 + compute.diskTypes.list.snippet.json | 1 + compute.disks.aggregatedList.snippet.json | 1 + compute.disks.createSnapshot.snippet.json | 1 + compute.disks.delete.snippet.json | 1 + compute.disks.get.snippet.json | 1 + compute.disks.insert.snippet.json | 1 + compute.disks.list.snippet.json | 1 + compute.firewalls.delete.snippet.json | 1 + compute.firewalls.get.snippet.json | 1 + compute.firewalls.insert.snippet.json | 1 + compute.firewalls.list.snippet.json | 1 + compute.firewalls.patch.snippet.json | 1 + compute.firewalls.update.snippet.json | 1 + compute.forwardingRules.aggregatedList.snippet.json | 1 + compute.forwardingRules.delete.snippet.json | 1 + compute.forwardingRules.get.snippet.json | 1 + compute.forwardingRules.insert.snippet.json | 1 + compute.forwardingRules.list.snippet.json | 1 + compute.forwardingRules.setTarget.snippet.json | 1 + compute.globalAddresses.delete.snippet.json | 1 + compute.globalAddresses.get.snippet.json | 1 + compute.globalAddresses.insert.snippet.json | 1 + compute.globalAddresses.list.snippet.json | 1 + compute.globalForwardingRules.delete.snippet.json | 1 + compute.globalForwardingRules.get.snippet.json | 1 + compute.globalForwardingRules.insert.snippet.json | 1 + compute.globalForwardingRules.list.snippet.json | 1 + compute.globalForwardingRules.setTarget.snippet.json | 1 + compute.globalOperations.aggregatedList.snippet.json | 1 + compute.globalOperations.delete.snippet.json | 1 + compute.globalOperations.get.snippet.json | 1 + compute.globalOperations.list.snippet.json | 1 + compute.httpHealthChecks.delete.snippet.json | 1 + compute.httpHealthChecks.get.snippet.json | 1 + compute.httpHealthChecks.insert.snippet.json | 1 + compute.httpHealthChecks.list.snippet.json | 1 + compute.httpHealthChecks.patch.snippet.json | 1 + compute.httpHealthChecks.update.snippet.json | 1 + compute.httpsHealthChecks.delete.snippet.json | 1 + compute.httpsHealthChecks.get.snippet.json | 1 + compute.httpsHealthChecks.insert.snippet.json | 1 + compute.httpsHealthChecks.list.snippet.json | 1 + compute.httpsHealthChecks.patch.snippet.json | 1 + compute.httpsHealthChecks.update.snippet.json | 1 + compute.images.delete.snippet.json | 1 + compute.images.deprecate.snippet.json | 1 + compute.images.get.snippet.json | 1 + compute.images.insert.snippet.json | 1 + compute.images.list.snippet.json | 1 + compute.instanceGroupManagers.abandonInstances.snippet.json | 1 + compute.instanceGroupManagers.aggregatedList.snippet.json | 1 + compute.instanceGroupManagers.delete.snippet.json | 1 + compute.instanceGroupManagers.deleteInstances.snippet.json | 1 + compute.instanceGroupManagers.get.snippet.json | 1 + compute.instanceGroupManagers.insert.snippet.json | 1 + compute.instanceGroupManagers.list.snippet.json | 1 + compute.instanceGroupManagers.listManagedInstances.snippet.json | 1 + compute.instanceGroupManagers.recreateInstances.snippet.json | 1 + compute.instanceGroupManagers.resize.snippet.json | 1 + compute.instanceGroupManagers.setInstanceTemplate.snippet.json | 1 + compute.instanceGroupManagers.setTargetPools.snippet.json | 1 + compute.instanceGroups.addInstances.snippet.json | 1 + compute.instanceGroups.aggregatedList.snippet.json | 1 + compute.instanceGroups.delete.snippet.json | 1 + compute.instanceGroups.get.snippet.json | 1 + compute.instanceGroups.insert.snippet.json | 1 + compute.instanceGroups.list.snippet.json | 1 + compute.instanceGroups.listInstances.snippet.json | 1 + compute.instanceGroups.removeInstances.snippet.json | 1 + compute.instanceGroups.setNamedPorts.snippet.json | 1 + compute.instanceTemplates.delete.snippet.json | 1 + compute.instanceTemplates.get.snippet.json | 1 + compute.instanceTemplates.insert.snippet.json | 1 + compute.instanceTemplates.list.snippet.json | 1 + compute.instances.addAccessConfig.snippet.json | 1 + compute.instances.aggregatedList.snippet.json | 1 + compute.instances.attachDisk.snippet.json | 1 + compute.instances.delete.snippet.json | 1 + compute.instances.deleteAccessConfig.snippet.json | 1 + compute.instances.detachDisk.snippet.json | 1 + compute.instances.get.snippet.json | 1 + compute.instances.getSerialPortOutput.snippet.json | 1 + compute.instances.insert.snippet.json | 1 + compute.instances.list.snippet.json | 1 + compute.instances.reset.snippet.json | 1 + compute.instances.setDiskAutoDelete.snippet.json | 1 + compute.instances.setMachineType.snippet.json | 1 + compute.instances.setMetadata.snippet.json | 1 + compute.instances.setScheduling.snippet.json | 1 + compute.instances.setTags.snippet.json | 1 + compute.instances.start.snippet.json | 1 + compute.instances.stop.snippet.json | 1 + compute.licenses.get.snippet.json | 1 + compute.machineTypes.aggregatedList.snippet.json | 1 + compute.machineTypes.get.snippet.json | 1 + compute.machineTypes.list.snippet.json | 1 + compute.networks.delete.snippet.json | 1 + compute.networks.get.snippet.json | 1 + compute.networks.insert.snippet.json | 1 + compute.networks.list.snippet.json | 1 + compute.projects.get.snippet.json | 1 + compute.projects.moveDisk.snippet.json | 1 + compute.projects.moveInstance.snippet.json | 1 + compute.projects.setCommonInstanceMetadata.snippet.json | 1 + compute.projects.setUsageExportBucket.snippet.json | 1 + compute.regionOperations.delete.snippet.json | 1 + compute.regionOperations.get.snippet.json | 1 + compute.regionOperations.list.snippet.json | 1 + compute.regions.get.snippet.json | 1 + compute.regions.list.snippet.json | 1 + compute.routes.delete.snippet.json | 1 + compute.routes.get.snippet.json | 1 + compute.routes.insert.snippet.json | 1 + compute.routes.list.snippet.json | 1 + compute.snapshots.delete.snippet.json | 1 + compute.snapshots.get.snippet.json | 1 + compute.snapshots.list.snippet.json | 1 + compute.sslCertificates.delete.snippet.json | 1 + compute.sslCertificates.get.snippet.json | 1 + compute.sslCertificates.insert.snippet.json | 1 + compute.sslCertificates.list.snippet.json | 1 + compute.subnetworks.aggregatedList.snippet.json | 1 + compute.subnetworks.delete.snippet.json | 1 + compute.subnetworks.get.snippet.json | 1 + compute.subnetworks.insert.snippet.json | 1 + compute.subnetworks.list.snippet.json | 1 + compute.targetHttpProxies.delete.snippet.json | 1 + compute.targetHttpProxies.get.snippet.json | 1 + compute.targetHttpProxies.insert.snippet.json | 1 + compute.targetHttpProxies.list.snippet.json | 1 + compute.targetHttpProxies.setUrlMap.snippet.json | 1 + compute.targetHttpsProxies.delete.snippet.json | 1 + compute.targetHttpsProxies.get.snippet.json | 1 + compute.targetHttpsProxies.insert.snippet.json | 1 + compute.targetHttpsProxies.list.snippet.json | 1 + compute.targetHttpsProxies.setSslCertificates.snippet.json | 1 + compute.targetHttpsProxies.setUrlMap.snippet.json | 1 + compute.targetInstances.aggregatedList.snippet.json | 1 + compute.targetInstances.delete.snippet.json | 1 + compute.targetInstances.get.snippet.json | 1 + compute.targetInstances.insert.snippet.json | 1 + compute.targetInstances.list.snippet.json | 1 + compute.targetPools.addHealthCheck.snippet.json | 1 + compute.targetPools.addInstance.snippet.json | 1 + compute.targetPools.aggregatedList.snippet.json | 1 + compute.targetPools.delete.snippet.json | 1 + compute.targetPools.get.snippet.json | 1 + compute.targetPools.getHealth.snippet.json | 1 + compute.targetPools.insert.snippet.json | 1 + compute.targetPools.list.snippet.json | 1 + compute.targetPools.removeHealthCheck.snippet.json | 1 + compute.targetPools.removeInstance.snippet.json | 1 + compute.targetPools.setBackup.snippet.json | 1 + compute.targetVpnGateways.aggregatedList.snippet.json | 1 + compute.targetVpnGateways.delete.snippet.json | 1 + compute.targetVpnGateways.get.snippet.json | 1 + compute.targetVpnGateways.insert.snippet.json | 1 + compute.targetVpnGateways.list.snippet.json | 1 + compute.urlMaps.delete.snippet.json | 1 + compute.urlMaps.get.snippet.json | 1 + compute.urlMaps.insert.snippet.json | 1 + compute.urlMaps.list.snippet.json | 1 + compute.urlMaps.patch.snippet.json | 1 + compute.urlMaps.update.snippet.json | 1 + compute.urlMaps.validate.snippet.json | 1 + compute.vpnTunnels.aggregatedList.snippet.json | 1 + compute.vpnTunnels.delete.snippet.json | 1 + compute.vpnTunnels.get.snippet.json | 1 + compute.vpnTunnels.insert.snippet.json | 1 + compute.vpnTunnels.list.snippet.json | 1 + compute.zoneOperations.delete.snippet.json | 1 + compute.zoneOperations.get.snippet.json | 1 + compute.zoneOperations.list.snippet.json | 1 + compute.zones.get.snippet.json | 1 + compute.zones.list.snippet.json | 1 + container.projects.zones.clusters.create.snippet.json | 1 + container.projects.zones.clusters.delete.snippet.json | 1 + container.projects.zones.clusters.get.snippet.json | 1 + container.projects.zones.clusters.list.snippet.json | 1 + container.projects.zones.clusters.update.snippet.json | 1 + container.projects.zones.getServerconfig.snippet.json | 1 + container.projects.zones.operations.get.snippet.json | 1 + container.projects.zones.operations.list.snippet.json | 1 + dataflow.projects.jobs.create.snippet.json | 1 + dataflow.projects.jobs.get.snippet.json | 1 + dataflow.projects.jobs.getMetrics.snippet.json | 1 + dataflow.projects.jobs.list.snippet.json | 1 + dataflow.projects.jobs.messages.list.snippet.json | 1 + dataflow.projects.jobs.update.snippet.json | 1 + dataflow.projects.jobs.workItems.lease.snippet.json | 1 + dataflow.projects.jobs.workItems.reportStatus.snippet.json | 1 + dataflow.projects.workerMessages.snippet.json | 1 + dataproc.media.download.snippet.json | 1 + dataproc.media.upload.snippet.json | 1 + datastore.datasets.allocateIds.snippet.json | 1 + datastore.datasets.beginTransaction.snippet.json | 1 + datastore.datasets.commit.snippet.json | 1 + datastore.datasets.lookup.snippet.json | 1 + datastore.datasets.rollback.snippet.json | 1 + datastore.datasets.runQuery.snippet.json | 1 + deploymentmanager.deployments.cancelPreview.snippet.json | 1 + deploymentmanager.deployments.delete.snippet.json | 1 + deploymentmanager.deployments.get.snippet.json | 1 + deploymentmanager.deployments.insert.snippet.json | 1 + deploymentmanager.deployments.list.snippet.json | 1 + deploymentmanager.deployments.patch.snippet.json | 1 + deploymentmanager.deployments.stop.snippet.json | 1 + deploymentmanager.deployments.update.snippet.json | 1 + deploymentmanager.manifests.get.snippet.json | 1 + deploymentmanager.manifests.list.snippet.json | 1 + deploymentmanager.operations.get.snippet.json | 1 + deploymentmanager.operations.list.snippet.json | 1 + deploymentmanager.resources.get.snippet.json | 1 + deploymentmanager.resources.list.snippet.json | 1 + deploymentmanager.types.list.snippet.json | 1 + dns.changes.create.snippet.json | 1 + dns.changes.get.snippet.json | 1 + dns.changes.list.snippet.json | 1 + dns.managedZones.create.snippet.json | 1 + dns.managedZones.delete.snippet.json | 1 + dns.managedZones.get.snippet.json | 1 + dns.managedZones.list.snippet.json | 1 + dns.projects.get.snippet.json | 1 + dns.resourceRecordSets.list.snippet.json | 1 + iam.projects.serviceAccounts.create.snippet.json | 1 + iam.projects.serviceAccounts.delete.snippet.json | 1 + iam.projects.serviceAccounts.get.snippet.json | 1 + iam.projects.serviceAccounts.getIamPolicy.snippet.json | 1 + iam.projects.serviceAccounts.keys.create.snippet.json | 1 + iam.projects.serviceAccounts.keys.delete.snippet.json | 1 + iam.projects.serviceAccounts.keys.get.snippet.json | 1 + iam.projects.serviceAccounts.keys.list.snippet.json | 1 + iam.projects.serviceAccounts.list.snippet.json | 1 + iam.projects.serviceAccounts.setIamPolicy.snippet.json | 1 + iam.projects.serviceAccounts.signBlob.snippet.json | 1 + iam.projects.serviceAccounts.testIamPermissions.snippet.json | 1 + iam.projects.serviceAccounts.update.snippet.json | 1 + language.detections.list.snippet.json | 1 + language.languages.list.snippet.json | 1 + language.translations.list.snippet.json | 1 + logging.entries.list.snippet.json | 1 + logging.entries.write.snippet.json | 1 + logging.monitoredResourceDescriptors.list.snippet.json | 1 + logging.projects.logs.delete.snippet.json | 1 + logging.projects.metrics.create.snippet.json | 1 + logging.projects.metrics.delete.snippet.json | 1 + logging.projects.metrics.get.snippet.json | 1 + logging.projects.metrics.list.snippet.json | 1 + logging.projects.metrics.update.snippet.json | 1 + logging.projects.sinks.create.snippet.json | 1 + logging.projects.sinks.delete.snippet.json | 1 + logging.projects.sinks.get.snippet.json | 1 + logging.projects.sinks.list.snippet.json | 1 + logging.projects.sinks.update.snippet.json | 1 + manager.deployments.delete.snippet.json | 1 + manager.deployments.get.snippet.json | 1 + manager.deployments.insert.snippet.json | 1 + manager.deployments.list.snippet.json | 1 + manager.templates.delete.snippet.json | 1 + manager.templates.get.snippet.json | 1 + manager.templates.insert.snippet.json | 1 + manager.templates.list.snippet.json | 1 + prediction.hostedmodels.predict.snippet.json | 1 + prediction.trainedmodels.analyze.snippet.json | 1 + prediction.trainedmodels.delete.snippet.json | 1 + prediction.trainedmodels.get.snippet.json | 1 + prediction.trainedmodels.insert.snippet.json | 1 + prediction.trainedmodels.list.snippet.json | 1 + prediction.trainedmodels.predict.snippet.json | 1 + prediction.trainedmodels.update.snippet.json | 1 + pubsub.projects.subscriptions.acknowledge.snippet.json | 1 + pubsub.projects.subscriptions.create.snippet.json | 1 + pubsub.projects.subscriptions.delete.snippet.json | 1 + pubsub.projects.subscriptions.get.snippet.json | 1 + pubsub.projects.subscriptions.getIamPolicy.snippet.json | 1 + pubsub.projects.subscriptions.list.snippet.json | 1 + pubsub.projects.subscriptions.modifyAckDeadline.snippet.json | 1 + pubsub.projects.subscriptions.modifyPushConfig.snippet.json | 1 + pubsub.projects.subscriptions.pull.snippet.json | 1 + pubsub.projects.subscriptions.setIamPolicy.snippet.json | 1 + pubsub.projects.subscriptions.testIamPermissions.snippet.json | 1 + pubsub.projects.topics.create.snippet.json | 1 + pubsub.projects.topics.delete.snippet.json | 1 + pubsub.projects.topics.get.snippet.json | 1 + pubsub.projects.topics.getIamPolicy.snippet.json | 1 + pubsub.projects.topics.list.snippet.json | 1 + pubsub.projects.topics.publish.snippet.json | 1 + pubsub.projects.topics.setIamPolicy.snippet.json | 1 + pubsub.projects.topics.subscriptions.list.snippet.json | 1 + pubsub.projects.topics.testIamPermissions.snippet.json | 1 + replicapool.instanceGroupManagers.abandonInstances.snippet.json | 1 + replicapool.instanceGroupManagers.delete.snippet.json | 1 + replicapool.instanceGroupManagers.deleteInstances.snippet.json | 1 + replicapool.instanceGroupManagers.get.snippet.json | 1 + replicapool.instanceGroupManagers.insert.snippet.json | 1 + replicapool.instanceGroupManagers.list.snippet.json | 1 + replicapool.instanceGroupManagers.recreateInstances.snippet.json | 1 + replicapool.instanceGroupManagers.resize.snippet.json | 1 + ...capool.instanceGroupManagers.setInstanceTemplate.snippet.json | 1 + replicapool.instanceGroupManagers.setTargetPools.snippet.json | 1 + replicapool.zoneOperations.get.snippet.json | 1 + replicapool.zoneOperations.list.snippet.json | 1 + replicapoolupdater.rollingUpdates.cancel.snippet.json | 1 + replicapoolupdater.rollingUpdates.get.snippet.json | 1 + replicapoolupdater.rollingUpdates.insert.snippet.json | 1 + replicapoolupdater.rollingUpdates.list.snippet.json | 1 + ...capoolupdater.rollingUpdates.listInstanceUpdates.snippet.json | 1 + replicapoolupdater.rollingUpdates.pause.snippet.json | 1 + replicapoolupdater.rollingUpdates.resume.snippet.json | 1 + replicapoolupdater.rollingUpdates.rollback.snippet.json | 1 + replicapoolupdater.zoneOperations.get.snippet.json | 1 + replicapoolupdater.zoneOperations.list.snippet.json | 1 + resourceviews.zoneOperations.get.snippet.json | 1 + resourceviews.zoneOperations.list.snippet.json | 1 + resourceviews.zoneViews.addResources.snippet.json | 1 + resourceviews.zoneViews.delete.snippet.json | 1 + resourceviews.zoneViews.get.snippet.json | 1 + resourceviews.zoneViews.getService.snippet.json | 1 + resourceviews.zoneViews.insert.snippet.json | 1 + resourceviews.zoneViews.list.snippet.json | 1 + resourceviews.zoneViews.listResources.snippet.json | 1 + resourceviews.zoneViews.removeResources.snippet.json | 1 + resourceviews.zoneViews.setService.snippet.json | 1 + sql.backupRuns.delete.snippet.json | 1 + sql.backupRuns.get.snippet.json | 1 + sql.backupRuns.list.snippet.json | 1 + sql.databases.delete.snippet.json | 1 + sql.databases.get.snippet.json | 1 + sql.databases.insert.snippet.json | 1 + sql.databases.list.snippet.json | 1 + sql.databases.patch.snippet.json | 1 + sql.databases.update.snippet.json | 1 + sql.flags.list.snippet.json | 1 + sql.instances.clone.snippet.json | 1 + sql.instances.delete.snippet.json | 1 + sql.instances.export.snippet.json | 1 + sql.instances.failover.snippet.json | 1 + sql.instances.get.snippet.json | 1 + sql.instances.import.snippet.json | 1 + sql.instances.insert.snippet.json | 1 + sql.instances.list.snippet.json | 1 + sql.instances.patch.snippet.json | 1 + sql.instances.promoteReplica.snippet.json | 1 + sql.instances.resetSslConfig.snippet.json | 1 + sql.instances.restart.snippet.json | 1 + sql.instances.restoreBackup.snippet.json | 1 + sql.instances.startReplica.snippet.json | 1 + sql.instances.stopReplica.snippet.json | 1 + sql.instances.update.snippet.json | 1 + sql.operations.get.snippet.json | 1 + sql.operations.list.snippet.json | 1 + sql.sslCerts.createEphemeral.snippet.json | 1 + sql.sslCerts.delete.snippet.json | 1 + sql.sslCerts.get.snippet.json | 1 + sql.sslCerts.insert.snippet.json | 1 + sql.sslCerts.list.snippet.json | 1 + sql.tiers.list.snippet.json | 1 + sql.users.delete.snippet.json | 1 + sql.users.insert.snippet.json | 1 + sql.users.list.snippet.json | 1 + sql.users.update.snippet.json | 1 + storage.bucketAccessControls.delete.snippet.json | 1 + storage.bucketAccessControls.get.snippet.json | 1 + storage.bucketAccessControls.insert.snippet.json | 1 + storage.bucketAccessControls.list.snippet.json | 1 + storage.bucketAccessControls.patch.snippet.json | 1 + storage.bucketAccessControls.update.snippet.json | 1 + storage.buckets.delete.snippet.json | 1 + storage.buckets.get.snippet.json | 1 + storage.buckets.insert.snippet.json | 1 + storage.buckets.list.snippet.json | 1 + storage.buckets.patch.snippet.json | 1 + storage.buckets.update.snippet.json | 1 + storage.channels.stop.snippet.json | 1 + storage.defaultObjectAccessControls.delete.snippet.json | 1 + storage.defaultObjectAccessControls.get.snippet.json | 1 + storage.defaultObjectAccessControls.insert.snippet.json | 1 + storage.defaultObjectAccessControls.list.snippet.json | 1 + storage.defaultObjectAccessControls.patch.snippet.json | 1 + storage.defaultObjectAccessControls.update.snippet.json | 1 + storage.objectAccessControls.delete.snippet.json | 1 + storage.objectAccessControls.get.snippet.json | 1 + storage.objectAccessControls.insert.snippet.json | 1 + storage.objectAccessControls.list.snippet.json | 1 + storage.objectAccessControls.patch.snippet.json | 1 + storage.objectAccessControls.update.snippet.json | 1 + storage.objects.compose.snippet.json | 1 + storage.objects.copy.snippet.json | 1 + storage.objects.delete.snippet.json | 1 + storage.objects.get.snippet.json | 1 + storage.objects.insert.snippet.json | 1 + storage.objects.list.snippet.json | 1 + storage.objects.patch.snippet.json | 1 + storage.objects.rewrite.snippet.json | 1 + storage.objects.update.snippet.json | 1 + storage.objects.watchAll.snippet.json | 1 + storagetransfer.getGoogleServiceAccount.snippet.json | 1 + storagetransfer.googleServiceAccounts.get.snippet.json | 1 + storagetransfer.transferJobs.create.snippet.json | 1 + storagetransfer.transferJobs.get.snippet.json | 1 + storagetransfer.transferJobs.list.snippet.json | 1 + storagetransfer.transferJobs.patch.snippet.json | 1 + storagetransfer.transferOperations.cancel.snippet.json | 1 + storagetransfer.transferOperations.delete.snippet.json | 1 + storagetransfer.transferOperations.get.snippet.json | 1 + storagetransfer.transferOperations.list.snippet.json | 1 + storagetransfer.transferOperations.pause.snippet.json | 1 + storagetransfer.transferOperations.resume.snippet.json | 1 + taskqueue.taskqueues.get.snippet.json | 1 + taskqueue.tasks.delete.snippet.json | 1 + taskqueue.tasks.get.snippet.json | 1 + taskqueue.tasks.insert.snippet.json | 1 + taskqueue.tasks.lease.snippet.json | 1 + taskqueue.tasks.list.snippet.json | 1 + taskqueue.tasks.patch.snippet.json | 1 + taskqueue.tasks.update.snippet.json | 1 + 533 files changed, 533 insertions(+) create mode 100644 appengine.apps.get.snippet.json create mode 100644 appengine.apps.modules.delete.snippet.json create mode 100644 appengine.apps.modules.get.snippet.json create mode 100644 appengine.apps.modules.list.snippet.json create mode 100644 appengine.apps.modules.patch.snippet.json create mode 100644 appengine.apps.modules.versions.create.snippet.json create mode 100644 appengine.apps.modules.versions.delete.snippet.json create mode 100644 appengine.apps.modules.versions.get.snippet.json create mode 100644 appengine.apps.modules.versions.list.snippet.json create mode 100644 appengine.apps.operations.get.snippet.json create mode 100644 appengine.apps.operations.list.snippet.json create mode 100644 autoscaler.autoscalers.delete.snippet.json create mode 100644 autoscaler.autoscalers.get.snippet.json create mode 100644 autoscaler.autoscalers.insert.snippet.json create mode 100644 autoscaler.autoscalers.list.snippet.json create mode 100644 autoscaler.autoscalers.patch.snippet.json create mode 100644 autoscaler.autoscalers.update.snippet.json create mode 100644 autoscaler.zoneOperations.delete.snippet.json create mode 100644 autoscaler.zoneOperations.get.snippet.json create mode 100644 autoscaler.zoneOperations.list.snippet.json create mode 100644 autoscaler.zones.list.snippet.json create mode 100644 bigquery.datasets.delete.snippet.json create mode 100644 bigquery.datasets.get.snippet.json create mode 100644 bigquery.datasets.insert.snippet.json create mode 100644 bigquery.datasets.list.snippet.json create mode 100644 bigquery.datasets.patch.snippet.json create mode 100644 bigquery.datasets.update.snippet.json create mode 100644 bigquery.jobs.cancel.snippet.json create mode 100644 bigquery.jobs.get.snippet.json create mode 100644 bigquery.jobs.getQueryResults.snippet.json create mode 100644 bigquery.jobs.insert.snippet.json create mode 100644 bigquery.jobs.list.snippet.json create mode 100644 bigquery.jobs.query.snippet.json create mode 100644 bigquery.projects.list.snippet.json create mode 100644 bigquery.tabledata.insertAll.snippet.json create mode 100644 bigquery.tabledata.list.snippet.json create mode 100644 bigquery.tables.delete.snippet.json create mode 100644 bigquery.tables.get.snippet.json create mode 100644 bigquery.tables.insert.snippet.json create mode 100644 bigquery.tables.list.snippet.json create mode 100644 bigquery.tables.patch.snippet.json create mode 100644 bigquery.tables.update.snippet.json create mode 100644 cloudbilling.billingAccounts.get.snippet.json create mode 100644 cloudbilling.billingAccounts.list.snippet.json create mode 100644 cloudbilling.billingAccounts.projects.list.snippet.json create mode 100644 cloudbilling.projects.getBillingInfo.snippet.json create mode 100644 cloudbilling.projects.updateBillingInfo.snippet.json create mode 100644 clouddebugger.controller.debuggees.breakpoints.list.snippet.json create mode 100644 clouddebugger.controller.debuggees.breakpoints.update.snippet.json create mode 100644 clouddebugger.controller.debuggees.register.snippet.json create mode 100644 clouddebugger.debugger.debuggees.breakpoints.delete.snippet.json create mode 100644 clouddebugger.debugger.debuggees.breakpoints.get.snippet.json create mode 100644 clouddebugger.debugger.debuggees.breakpoints.list.snippet.json create mode 100644 clouddebugger.debugger.debuggees.breakpoints.set.snippet.json create mode 100644 clouddebugger.debugger.debuggees.list.snippet.json create mode 100644 cloudmonitoring.metricDescriptors.create.snippet.json create mode 100644 cloudmonitoring.metricDescriptors.delete.snippet.json create mode 100644 cloudmonitoring.metricDescriptors.list.snippet.json create mode 100644 cloudmonitoring.timeseries.list.snippet.json create mode 100644 cloudmonitoring.timeseries.write.snippet.json create mode 100644 cloudmonitoring.timeseriesDescriptors.list.snippet.json create mode 100644 cloudresourcemanager.organizations.get.snippet.json create mode 100644 cloudresourcemanager.organizations.getIamPolicy.snippet.json create mode 100644 cloudresourcemanager.organizations.list.snippet.json create mode 100644 cloudresourcemanager.organizations.setIamPolicy.snippet.json create mode 100644 cloudresourcemanager.organizations.testIamPermissions.snippet.json create mode 100644 cloudresourcemanager.organizations.update.snippet.json create mode 100644 cloudresourcemanager.projects.create.snippet.json create mode 100644 cloudresourcemanager.projects.delete.snippet.json create mode 100644 cloudresourcemanager.projects.get.snippet.json create mode 100644 cloudresourcemanager.projects.getIamPolicy.snippet.json create mode 100644 cloudresourcemanager.projects.list.snippet.json create mode 100644 cloudresourcemanager.projects.setIamPolicy.snippet.json create mode 100644 cloudresourcemanager.projects.testIamPermissions.snippet.json create mode 100644 cloudresourcemanager.projects.undelete.snippet.json create mode 100644 cloudresourcemanager.projects.update.snippet.json create mode 100644 cloudtrace.projects.patchTraces.snippet.json create mode 100644 cloudtrace.projects.traces.get.snippet.json create mode 100644 cloudtrace.projects.traces.list.snippet.json create mode 100644 clouduseraccounts.globalAccountsOperations.delete.snippet.json create mode 100644 clouduseraccounts.globalAccountsOperations.get.snippet.json create mode 100644 clouduseraccounts.globalAccountsOperations.list.snippet.json create mode 100644 clouduseraccounts.groups.addMember.snippet.json create mode 100644 clouduseraccounts.groups.delete.snippet.json create mode 100644 clouduseraccounts.groups.get.snippet.json create mode 100644 clouduseraccounts.groups.insert.snippet.json create mode 100644 clouduseraccounts.groups.list.snippet.json create mode 100644 clouduseraccounts.groups.removeMember.snippet.json create mode 100644 clouduseraccounts.linux.getAuthorizedKeysView.snippet.json create mode 100644 clouduseraccounts.linux.getLinuxAccountViews.snippet.json create mode 100644 clouduseraccounts.users.addPublicKey.snippet.json create mode 100644 clouduseraccounts.users.delete.snippet.json create mode 100644 clouduseraccounts.users.get.snippet.json create mode 100644 clouduseraccounts.users.insert.snippet.json create mode 100644 clouduseraccounts.users.list.snippet.json create mode 100644 clouduseraccounts.users.removePublicKey.snippet.json create mode 100644 compute.addresses.aggregatedList.snippet.json create mode 100644 compute.addresses.delete.snippet.json create mode 100644 compute.addresses.get.snippet.json create mode 100644 compute.addresses.insert.snippet.json create mode 100644 compute.addresses.list.snippet.json create mode 100644 compute.autoscalers.aggregatedList.snippet.json create mode 100644 compute.autoscalers.delete.snippet.json create mode 100644 compute.autoscalers.get.snippet.json create mode 100644 compute.autoscalers.insert.snippet.json create mode 100644 compute.autoscalers.list.snippet.json create mode 100644 compute.autoscalers.patch.snippet.json create mode 100644 compute.autoscalers.update.snippet.json create mode 100644 compute.backendServices.delete.snippet.json create mode 100644 compute.backendServices.get.snippet.json create mode 100644 compute.backendServices.getHealth.snippet.json create mode 100644 compute.backendServices.insert.snippet.json create mode 100644 compute.backendServices.list.snippet.json create mode 100644 compute.backendServices.patch.snippet.json create mode 100644 compute.backendServices.update.snippet.json create mode 100644 compute.diskTypes.aggregatedList.snippet.json create mode 100644 compute.diskTypes.get.snippet.json create mode 100644 compute.diskTypes.list.snippet.json create mode 100644 compute.disks.aggregatedList.snippet.json create mode 100644 compute.disks.createSnapshot.snippet.json create mode 100644 compute.disks.delete.snippet.json create mode 100644 compute.disks.get.snippet.json create mode 100644 compute.disks.insert.snippet.json create mode 100644 compute.disks.list.snippet.json create mode 100644 compute.firewalls.delete.snippet.json create mode 100644 compute.firewalls.get.snippet.json create mode 100644 compute.firewalls.insert.snippet.json create mode 100644 compute.firewalls.list.snippet.json create mode 100644 compute.firewalls.patch.snippet.json create mode 100644 compute.firewalls.update.snippet.json create mode 100644 compute.forwardingRules.aggregatedList.snippet.json create mode 100644 compute.forwardingRules.delete.snippet.json create mode 100644 compute.forwardingRules.get.snippet.json create mode 100644 compute.forwardingRules.insert.snippet.json create mode 100644 compute.forwardingRules.list.snippet.json create mode 100644 compute.forwardingRules.setTarget.snippet.json create mode 100644 compute.globalAddresses.delete.snippet.json create mode 100644 compute.globalAddresses.get.snippet.json create mode 100644 compute.globalAddresses.insert.snippet.json create mode 100644 compute.globalAddresses.list.snippet.json create mode 100644 compute.globalForwardingRules.delete.snippet.json create mode 100644 compute.globalForwardingRules.get.snippet.json create mode 100644 compute.globalForwardingRules.insert.snippet.json create mode 100644 compute.globalForwardingRules.list.snippet.json create mode 100644 compute.globalForwardingRules.setTarget.snippet.json create mode 100644 compute.globalOperations.aggregatedList.snippet.json create mode 100644 compute.globalOperations.delete.snippet.json create mode 100644 compute.globalOperations.get.snippet.json create mode 100644 compute.globalOperations.list.snippet.json create mode 100644 compute.httpHealthChecks.delete.snippet.json create mode 100644 compute.httpHealthChecks.get.snippet.json create mode 100644 compute.httpHealthChecks.insert.snippet.json create mode 100644 compute.httpHealthChecks.list.snippet.json create mode 100644 compute.httpHealthChecks.patch.snippet.json create mode 100644 compute.httpHealthChecks.update.snippet.json create mode 100644 compute.httpsHealthChecks.delete.snippet.json create mode 100644 compute.httpsHealthChecks.get.snippet.json create mode 100644 compute.httpsHealthChecks.insert.snippet.json create mode 100644 compute.httpsHealthChecks.list.snippet.json create mode 100644 compute.httpsHealthChecks.patch.snippet.json create mode 100644 compute.httpsHealthChecks.update.snippet.json create mode 100644 compute.images.delete.snippet.json create mode 100644 compute.images.deprecate.snippet.json create mode 100644 compute.images.get.snippet.json create mode 100644 compute.images.insert.snippet.json create mode 100644 compute.images.list.snippet.json create mode 100644 compute.instanceGroupManagers.abandonInstances.snippet.json create mode 100644 compute.instanceGroupManagers.aggregatedList.snippet.json create mode 100644 compute.instanceGroupManagers.delete.snippet.json create mode 100644 compute.instanceGroupManagers.deleteInstances.snippet.json create mode 100644 compute.instanceGroupManagers.get.snippet.json create mode 100644 compute.instanceGroupManagers.insert.snippet.json create mode 100644 compute.instanceGroupManagers.list.snippet.json create mode 100644 compute.instanceGroupManagers.listManagedInstances.snippet.json create mode 100644 compute.instanceGroupManagers.recreateInstances.snippet.json create mode 100644 compute.instanceGroupManagers.resize.snippet.json create mode 100644 compute.instanceGroupManagers.setInstanceTemplate.snippet.json create mode 100644 compute.instanceGroupManagers.setTargetPools.snippet.json create mode 100644 compute.instanceGroups.addInstances.snippet.json create mode 100644 compute.instanceGroups.aggregatedList.snippet.json create mode 100644 compute.instanceGroups.delete.snippet.json create mode 100644 compute.instanceGroups.get.snippet.json create mode 100644 compute.instanceGroups.insert.snippet.json create mode 100644 compute.instanceGroups.list.snippet.json create mode 100644 compute.instanceGroups.listInstances.snippet.json create mode 100644 compute.instanceGroups.removeInstances.snippet.json create mode 100644 compute.instanceGroups.setNamedPorts.snippet.json create mode 100644 compute.instanceTemplates.delete.snippet.json create mode 100644 compute.instanceTemplates.get.snippet.json create mode 100644 compute.instanceTemplates.insert.snippet.json create mode 100644 compute.instanceTemplates.list.snippet.json create mode 100644 compute.instances.addAccessConfig.snippet.json create mode 100644 compute.instances.aggregatedList.snippet.json create mode 100644 compute.instances.attachDisk.snippet.json create mode 100644 compute.instances.delete.snippet.json create mode 100644 compute.instances.deleteAccessConfig.snippet.json create mode 100644 compute.instances.detachDisk.snippet.json create mode 100644 compute.instances.get.snippet.json create mode 100644 compute.instances.getSerialPortOutput.snippet.json create mode 100644 compute.instances.insert.snippet.json create mode 100644 compute.instances.list.snippet.json create mode 100644 compute.instances.reset.snippet.json create mode 100644 compute.instances.setDiskAutoDelete.snippet.json create mode 100644 compute.instances.setMachineType.snippet.json create mode 100644 compute.instances.setMetadata.snippet.json create mode 100644 compute.instances.setScheduling.snippet.json create mode 100644 compute.instances.setTags.snippet.json create mode 100644 compute.instances.start.snippet.json create mode 100644 compute.instances.stop.snippet.json create mode 100644 compute.licenses.get.snippet.json create mode 100644 compute.machineTypes.aggregatedList.snippet.json create mode 100644 compute.machineTypes.get.snippet.json create mode 100644 compute.machineTypes.list.snippet.json create mode 100644 compute.networks.delete.snippet.json create mode 100644 compute.networks.get.snippet.json create mode 100644 compute.networks.insert.snippet.json create mode 100644 compute.networks.list.snippet.json create mode 100644 compute.projects.get.snippet.json create mode 100644 compute.projects.moveDisk.snippet.json create mode 100644 compute.projects.moveInstance.snippet.json create mode 100644 compute.projects.setCommonInstanceMetadata.snippet.json create mode 100644 compute.projects.setUsageExportBucket.snippet.json create mode 100644 compute.regionOperations.delete.snippet.json create mode 100644 compute.regionOperations.get.snippet.json create mode 100644 compute.regionOperations.list.snippet.json create mode 100644 compute.regions.get.snippet.json create mode 100644 compute.regions.list.snippet.json create mode 100644 compute.routes.delete.snippet.json create mode 100644 compute.routes.get.snippet.json create mode 100644 compute.routes.insert.snippet.json create mode 100644 compute.routes.list.snippet.json create mode 100644 compute.snapshots.delete.snippet.json create mode 100644 compute.snapshots.get.snippet.json create mode 100644 compute.snapshots.list.snippet.json create mode 100644 compute.sslCertificates.delete.snippet.json create mode 100644 compute.sslCertificates.get.snippet.json create mode 100644 compute.sslCertificates.insert.snippet.json create mode 100644 compute.sslCertificates.list.snippet.json create mode 100644 compute.subnetworks.aggregatedList.snippet.json create mode 100644 compute.subnetworks.delete.snippet.json create mode 100644 compute.subnetworks.get.snippet.json create mode 100644 compute.subnetworks.insert.snippet.json create mode 100644 compute.subnetworks.list.snippet.json create mode 100644 compute.targetHttpProxies.delete.snippet.json create mode 100644 compute.targetHttpProxies.get.snippet.json create mode 100644 compute.targetHttpProxies.insert.snippet.json create mode 100644 compute.targetHttpProxies.list.snippet.json create mode 100644 compute.targetHttpProxies.setUrlMap.snippet.json create mode 100644 compute.targetHttpsProxies.delete.snippet.json create mode 100644 compute.targetHttpsProxies.get.snippet.json create mode 100644 compute.targetHttpsProxies.insert.snippet.json create mode 100644 compute.targetHttpsProxies.list.snippet.json create mode 100644 compute.targetHttpsProxies.setSslCertificates.snippet.json create mode 100644 compute.targetHttpsProxies.setUrlMap.snippet.json create mode 100644 compute.targetInstances.aggregatedList.snippet.json create mode 100644 compute.targetInstances.delete.snippet.json create mode 100644 compute.targetInstances.get.snippet.json create mode 100644 compute.targetInstances.insert.snippet.json create mode 100644 compute.targetInstances.list.snippet.json create mode 100644 compute.targetPools.addHealthCheck.snippet.json create mode 100644 compute.targetPools.addInstance.snippet.json create mode 100644 compute.targetPools.aggregatedList.snippet.json create mode 100644 compute.targetPools.delete.snippet.json create mode 100644 compute.targetPools.get.snippet.json create mode 100644 compute.targetPools.getHealth.snippet.json create mode 100644 compute.targetPools.insert.snippet.json create mode 100644 compute.targetPools.list.snippet.json create mode 100644 compute.targetPools.removeHealthCheck.snippet.json create mode 100644 compute.targetPools.removeInstance.snippet.json create mode 100644 compute.targetPools.setBackup.snippet.json create mode 100644 compute.targetVpnGateways.aggregatedList.snippet.json create mode 100644 compute.targetVpnGateways.delete.snippet.json create mode 100644 compute.targetVpnGateways.get.snippet.json create mode 100644 compute.targetVpnGateways.insert.snippet.json create mode 100644 compute.targetVpnGateways.list.snippet.json create mode 100644 compute.urlMaps.delete.snippet.json create mode 100644 compute.urlMaps.get.snippet.json create mode 100644 compute.urlMaps.insert.snippet.json create mode 100644 compute.urlMaps.list.snippet.json create mode 100644 compute.urlMaps.patch.snippet.json create mode 100644 compute.urlMaps.update.snippet.json create mode 100644 compute.urlMaps.validate.snippet.json create mode 100644 compute.vpnTunnels.aggregatedList.snippet.json create mode 100644 compute.vpnTunnels.delete.snippet.json create mode 100644 compute.vpnTunnels.get.snippet.json create mode 100644 compute.vpnTunnels.insert.snippet.json create mode 100644 compute.vpnTunnels.list.snippet.json create mode 100644 compute.zoneOperations.delete.snippet.json create mode 100644 compute.zoneOperations.get.snippet.json create mode 100644 compute.zoneOperations.list.snippet.json create mode 100644 compute.zones.get.snippet.json create mode 100644 compute.zones.list.snippet.json create mode 100644 container.projects.zones.clusters.create.snippet.json create mode 100644 container.projects.zones.clusters.delete.snippet.json create mode 100644 container.projects.zones.clusters.get.snippet.json create mode 100644 container.projects.zones.clusters.list.snippet.json create mode 100644 container.projects.zones.clusters.update.snippet.json create mode 100644 container.projects.zones.getServerconfig.snippet.json create mode 100644 container.projects.zones.operations.get.snippet.json create mode 100644 container.projects.zones.operations.list.snippet.json create mode 100644 dataflow.projects.jobs.create.snippet.json create mode 100644 dataflow.projects.jobs.get.snippet.json create mode 100644 dataflow.projects.jobs.getMetrics.snippet.json create mode 100644 dataflow.projects.jobs.list.snippet.json create mode 100644 dataflow.projects.jobs.messages.list.snippet.json create mode 100644 dataflow.projects.jobs.update.snippet.json create mode 100644 dataflow.projects.jobs.workItems.lease.snippet.json create mode 100644 dataflow.projects.jobs.workItems.reportStatus.snippet.json create mode 100644 dataflow.projects.workerMessages.snippet.json create mode 100644 dataproc.media.download.snippet.json create mode 100644 dataproc.media.upload.snippet.json create mode 100644 datastore.datasets.allocateIds.snippet.json create mode 100644 datastore.datasets.beginTransaction.snippet.json create mode 100644 datastore.datasets.commit.snippet.json create mode 100644 datastore.datasets.lookup.snippet.json create mode 100644 datastore.datasets.rollback.snippet.json create mode 100644 datastore.datasets.runQuery.snippet.json create mode 100644 deploymentmanager.deployments.cancelPreview.snippet.json create mode 100644 deploymentmanager.deployments.delete.snippet.json create mode 100644 deploymentmanager.deployments.get.snippet.json create mode 100644 deploymentmanager.deployments.insert.snippet.json create mode 100644 deploymentmanager.deployments.list.snippet.json create mode 100644 deploymentmanager.deployments.patch.snippet.json create mode 100644 deploymentmanager.deployments.stop.snippet.json create mode 100644 deploymentmanager.deployments.update.snippet.json create mode 100644 deploymentmanager.manifests.get.snippet.json create mode 100644 deploymentmanager.manifests.list.snippet.json create mode 100644 deploymentmanager.operations.get.snippet.json create mode 100644 deploymentmanager.operations.list.snippet.json create mode 100644 deploymentmanager.resources.get.snippet.json create mode 100644 deploymentmanager.resources.list.snippet.json create mode 100644 deploymentmanager.types.list.snippet.json create mode 100644 dns.changes.create.snippet.json create mode 100644 dns.changes.get.snippet.json create mode 100644 dns.changes.list.snippet.json create mode 100644 dns.managedZones.create.snippet.json create mode 100644 dns.managedZones.delete.snippet.json create mode 100644 dns.managedZones.get.snippet.json create mode 100644 dns.managedZones.list.snippet.json create mode 100644 dns.projects.get.snippet.json create mode 100644 dns.resourceRecordSets.list.snippet.json create mode 100644 iam.projects.serviceAccounts.create.snippet.json create mode 100644 iam.projects.serviceAccounts.delete.snippet.json create mode 100644 iam.projects.serviceAccounts.get.snippet.json create mode 100644 iam.projects.serviceAccounts.getIamPolicy.snippet.json create mode 100644 iam.projects.serviceAccounts.keys.create.snippet.json create mode 100644 iam.projects.serviceAccounts.keys.delete.snippet.json create mode 100644 iam.projects.serviceAccounts.keys.get.snippet.json create mode 100644 iam.projects.serviceAccounts.keys.list.snippet.json create mode 100644 iam.projects.serviceAccounts.list.snippet.json create mode 100644 iam.projects.serviceAccounts.setIamPolicy.snippet.json create mode 100644 iam.projects.serviceAccounts.signBlob.snippet.json create mode 100644 iam.projects.serviceAccounts.testIamPermissions.snippet.json create mode 100644 iam.projects.serviceAccounts.update.snippet.json create mode 100644 language.detections.list.snippet.json create mode 100644 language.languages.list.snippet.json create mode 100644 language.translations.list.snippet.json create mode 100644 logging.entries.list.snippet.json create mode 100644 logging.entries.write.snippet.json create mode 100644 logging.monitoredResourceDescriptors.list.snippet.json create mode 100644 logging.projects.logs.delete.snippet.json create mode 100644 logging.projects.metrics.create.snippet.json create mode 100644 logging.projects.metrics.delete.snippet.json create mode 100644 logging.projects.metrics.get.snippet.json create mode 100644 logging.projects.metrics.list.snippet.json create mode 100644 logging.projects.metrics.update.snippet.json create mode 100644 logging.projects.sinks.create.snippet.json create mode 100644 logging.projects.sinks.delete.snippet.json create mode 100644 logging.projects.sinks.get.snippet.json create mode 100644 logging.projects.sinks.list.snippet.json create mode 100644 logging.projects.sinks.update.snippet.json create mode 100644 manager.deployments.delete.snippet.json create mode 100644 manager.deployments.get.snippet.json create mode 100644 manager.deployments.insert.snippet.json create mode 100644 manager.deployments.list.snippet.json create mode 100644 manager.templates.delete.snippet.json create mode 100644 manager.templates.get.snippet.json create mode 100644 manager.templates.insert.snippet.json create mode 100644 manager.templates.list.snippet.json create mode 100644 prediction.hostedmodels.predict.snippet.json create mode 100644 prediction.trainedmodels.analyze.snippet.json create mode 100644 prediction.trainedmodels.delete.snippet.json create mode 100644 prediction.trainedmodels.get.snippet.json create mode 100644 prediction.trainedmodels.insert.snippet.json create mode 100644 prediction.trainedmodels.list.snippet.json create mode 100644 prediction.trainedmodels.predict.snippet.json create mode 100644 prediction.trainedmodels.update.snippet.json create mode 100644 pubsub.projects.subscriptions.acknowledge.snippet.json create mode 100644 pubsub.projects.subscriptions.create.snippet.json create mode 100644 pubsub.projects.subscriptions.delete.snippet.json create mode 100644 pubsub.projects.subscriptions.get.snippet.json create mode 100644 pubsub.projects.subscriptions.getIamPolicy.snippet.json create mode 100644 pubsub.projects.subscriptions.list.snippet.json create mode 100644 pubsub.projects.subscriptions.modifyAckDeadline.snippet.json create mode 100644 pubsub.projects.subscriptions.modifyPushConfig.snippet.json create mode 100644 pubsub.projects.subscriptions.pull.snippet.json create mode 100644 pubsub.projects.subscriptions.setIamPolicy.snippet.json create mode 100644 pubsub.projects.subscriptions.testIamPermissions.snippet.json create mode 100644 pubsub.projects.topics.create.snippet.json create mode 100644 pubsub.projects.topics.delete.snippet.json create mode 100644 pubsub.projects.topics.get.snippet.json create mode 100644 pubsub.projects.topics.getIamPolicy.snippet.json create mode 100644 pubsub.projects.topics.list.snippet.json create mode 100644 pubsub.projects.topics.publish.snippet.json create mode 100644 pubsub.projects.topics.setIamPolicy.snippet.json create mode 100644 pubsub.projects.topics.subscriptions.list.snippet.json create mode 100644 pubsub.projects.topics.testIamPermissions.snippet.json create mode 100644 replicapool.instanceGroupManagers.abandonInstances.snippet.json create mode 100644 replicapool.instanceGroupManagers.delete.snippet.json create mode 100644 replicapool.instanceGroupManagers.deleteInstances.snippet.json create mode 100644 replicapool.instanceGroupManagers.get.snippet.json create mode 100644 replicapool.instanceGroupManagers.insert.snippet.json create mode 100644 replicapool.instanceGroupManagers.list.snippet.json create mode 100644 replicapool.instanceGroupManagers.recreateInstances.snippet.json create mode 100644 replicapool.instanceGroupManagers.resize.snippet.json create mode 100644 replicapool.instanceGroupManagers.setInstanceTemplate.snippet.json create mode 100644 replicapool.instanceGroupManagers.setTargetPools.snippet.json create mode 100644 replicapool.zoneOperations.get.snippet.json create mode 100644 replicapool.zoneOperations.list.snippet.json create mode 100644 replicapoolupdater.rollingUpdates.cancel.snippet.json create mode 100644 replicapoolupdater.rollingUpdates.get.snippet.json create mode 100644 replicapoolupdater.rollingUpdates.insert.snippet.json create mode 100644 replicapoolupdater.rollingUpdates.list.snippet.json create mode 100644 replicapoolupdater.rollingUpdates.listInstanceUpdates.snippet.json create mode 100644 replicapoolupdater.rollingUpdates.pause.snippet.json create mode 100644 replicapoolupdater.rollingUpdates.resume.snippet.json create mode 100644 replicapoolupdater.rollingUpdates.rollback.snippet.json create mode 100644 replicapoolupdater.zoneOperations.get.snippet.json create mode 100644 replicapoolupdater.zoneOperations.list.snippet.json create mode 100644 resourceviews.zoneOperations.get.snippet.json create mode 100644 resourceviews.zoneOperations.list.snippet.json create mode 100644 resourceviews.zoneViews.addResources.snippet.json create mode 100644 resourceviews.zoneViews.delete.snippet.json create mode 100644 resourceviews.zoneViews.get.snippet.json create mode 100644 resourceviews.zoneViews.getService.snippet.json create mode 100644 resourceviews.zoneViews.insert.snippet.json create mode 100644 resourceviews.zoneViews.list.snippet.json create mode 100644 resourceviews.zoneViews.listResources.snippet.json create mode 100644 resourceviews.zoneViews.removeResources.snippet.json create mode 100644 resourceviews.zoneViews.setService.snippet.json create mode 100644 sql.backupRuns.delete.snippet.json create mode 100644 sql.backupRuns.get.snippet.json create mode 100644 sql.backupRuns.list.snippet.json create mode 100644 sql.databases.delete.snippet.json create mode 100644 sql.databases.get.snippet.json create mode 100644 sql.databases.insert.snippet.json create mode 100644 sql.databases.list.snippet.json create mode 100644 sql.databases.patch.snippet.json create mode 100644 sql.databases.update.snippet.json create mode 100644 sql.flags.list.snippet.json create mode 100644 sql.instances.clone.snippet.json create mode 100644 sql.instances.delete.snippet.json create mode 100644 sql.instances.export.snippet.json create mode 100644 sql.instances.failover.snippet.json create mode 100644 sql.instances.get.snippet.json create mode 100644 sql.instances.import.snippet.json create mode 100644 sql.instances.insert.snippet.json create mode 100644 sql.instances.list.snippet.json create mode 100644 sql.instances.patch.snippet.json create mode 100644 sql.instances.promoteReplica.snippet.json create mode 100644 sql.instances.resetSslConfig.snippet.json create mode 100644 sql.instances.restart.snippet.json create mode 100644 sql.instances.restoreBackup.snippet.json create mode 100644 sql.instances.startReplica.snippet.json create mode 100644 sql.instances.stopReplica.snippet.json create mode 100644 sql.instances.update.snippet.json create mode 100644 sql.operations.get.snippet.json create mode 100644 sql.operations.list.snippet.json create mode 100644 sql.sslCerts.createEphemeral.snippet.json create mode 100644 sql.sslCerts.delete.snippet.json create mode 100644 sql.sslCerts.get.snippet.json create mode 100644 sql.sslCerts.insert.snippet.json create mode 100644 sql.sslCerts.list.snippet.json create mode 100644 sql.tiers.list.snippet.json create mode 100644 sql.users.delete.snippet.json create mode 100644 sql.users.insert.snippet.json create mode 100644 sql.users.list.snippet.json create mode 100644 sql.users.update.snippet.json create mode 100644 storage.bucketAccessControls.delete.snippet.json create mode 100644 storage.bucketAccessControls.get.snippet.json create mode 100644 storage.bucketAccessControls.insert.snippet.json create mode 100644 storage.bucketAccessControls.list.snippet.json create mode 100644 storage.bucketAccessControls.patch.snippet.json create mode 100644 storage.bucketAccessControls.update.snippet.json create mode 100644 storage.buckets.delete.snippet.json create mode 100644 storage.buckets.get.snippet.json create mode 100644 storage.buckets.insert.snippet.json create mode 100644 storage.buckets.list.snippet.json create mode 100644 storage.buckets.patch.snippet.json create mode 100644 storage.buckets.update.snippet.json create mode 100644 storage.channels.stop.snippet.json create mode 100644 storage.defaultObjectAccessControls.delete.snippet.json create mode 100644 storage.defaultObjectAccessControls.get.snippet.json create mode 100644 storage.defaultObjectAccessControls.insert.snippet.json create mode 100644 storage.defaultObjectAccessControls.list.snippet.json create mode 100644 storage.defaultObjectAccessControls.patch.snippet.json create mode 100644 storage.defaultObjectAccessControls.update.snippet.json create mode 100644 storage.objectAccessControls.delete.snippet.json create mode 100644 storage.objectAccessControls.get.snippet.json create mode 100644 storage.objectAccessControls.insert.snippet.json create mode 100644 storage.objectAccessControls.list.snippet.json create mode 100644 storage.objectAccessControls.patch.snippet.json create mode 100644 storage.objectAccessControls.update.snippet.json create mode 100644 storage.objects.compose.snippet.json create mode 100644 storage.objects.copy.snippet.json create mode 100644 storage.objects.delete.snippet.json create mode 100644 storage.objects.get.snippet.json create mode 100644 storage.objects.insert.snippet.json create mode 100644 storage.objects.list.snippet.json create mode 100644 storage.objects.patch.snippet.json create mode 100644 storage.objects.rewrite.snippet.json create mode 100644 storage.objects.update.snippet.json create mode 100644 storage.objects.watchAll.snippet.json create mode 100644 storagetransfer.getGoogleServiceAccount.snippet.json create mode 100644 storagetransfer.googleServiceAccounts.get.snippet.json create mode 100644 storagetransfer.transferJobs.create.snippet.json create mode 100644 storagetransfer.transferJobs.get.snippet.json create mode 100644 storagetransfer.transferJobs.list.snippet.json create mode 100644 storagetransfer.transferJobs.patch.snippet.json create mode 100644 storagetransfer.transferOperations.cancel.snippet.json create mode 100644 storagetransfer.transferOperations.delete.snippet.json create mode 100644 storagetransfer.transferOperations.get.snippet.json create mode 100644 storagetransfer.transferOperations.list.snippet.json create mode 100644 storagetransfer.transferOperations.pause.snippet.json create mode 100644 storagetransfer.transferOperations.resume.snippet.json create mode 100644 taskqueue.taskqueues.get.snippet.json create mode 100644 taskqueue.tasks.delete.snippet.json create mode 100644 taskqueue.tasks.get.snippet.json create mode 100644 taskqueue.tasks.insert.snippet.json create mode 100644 taskqueue.tasks.lease.snippet.json create mode 100644 taskqueue.tasks.list.snippet.json create mode 100644 taskqueue.tasks.patch.snippet.json create mode 100644 taskqueue.tasks.update.snippet.json diff --git a/appengine.apps.get.snippet.json b/appengine.apps.get.snippet.json new file mode 100644 index 0000000..e0f11c0 --- /dev/null +++ b/appengine.apps.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"appengine","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for appengine.apps.get\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\tAppengine.Apps.Get request = appengineService.apps().get(\"example-appsId\");\r\n\t\tApplication response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for appengine.apps.get\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\nservice.apps().get(appsId=\"example-appsId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for appengine.apps.get\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 request = appengineService.Apps.Get(\"example-appsId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/appengine.apps.modules.delete.snippet.json b/appengine.apps.modules.delete.snippet.json new file mode 100644 index 0000000..5f53233 --- /dev/null +++ b/appengine.apps.modules.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"appengine","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for appengine.apps.modules.delete\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\tAppengine.Apps.Modules.Delete request = appengineService.apps().modules().delete(\"example-appsId\", \"example-modulesId\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for appengine.apps.modules.delete\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\nservice.apps().modules().delete(appsId=\"example-appsId\", modulesId=\"example-modulesId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for appengine.apps.modules.delete\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 request = appengineService.Apps.Modules.Delete(\"example-appsId\", \"example-modulesId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/appengine.apps.modules.get.snippet.json b/appengine.apps.modules.get.snippet.json new file mode 100644 index 0000000..0718543 --- /dev/null +++ b/appengine.apps.modules.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"appengine","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for appengine.apps.modules.get\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\tAppengine.Apps.Modules.Get request = appengineService.apps().modules().get(\"example-appsId\", \"example-modulesId\");\r\n\t\tModule response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for appengine.apps.modules.get\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\nservice.apps().modules().get(appsId=\"example-appsId\", modulesId=\"example-modulesId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for appengine.apps.modules.get\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 request = appengineService.Apps.Modules.Get(\"example-appsId\", \"example-modulesId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/appengine.apps.modules.list.snippet.json b/appengine.apps.modules.list.snippet.json new file mode 100644 index 0000000..7bc58cf --- /dev/null +++ b/appengine.apps.modules.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"appengine","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for appengine.apps.modules.list\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\tListModulesResponse response;\r\n\t\tAppengine.Apps.Modules.List request = appengineService.apps().modules().list(\"example-appsId\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getModules() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Module item : response.getModules()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for appengine.apps.modules.list\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\nrequest = service.apps().modules().list(appsId=\"example-appsId\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.apps().modules().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for appengine.apps.modules.list\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 ListModulesResponse response;\r\n var request = appengineService.Apps.Modules.List(\"example-appsId\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Modules == null)\r\n continue;\r\n\r\n foreach (var item in response.Modules)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/appengine.apps.modules.patch.snippet.json b/appengine.apps.modules.patch.snippet.json new file mode 100644 index 0000000..ad976c6 --- /dev/null +++ b/appengine.apps.modules.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"appengine","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for appengine.apps.modules.patch\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\t// Obtain the Module object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tAppengine.Apps.Modules.Patch request = appengineService.apps().modules().patch(\"example-appsId\", \"example-modulesId\", module);\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for appengine.apps.modules.patch\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\n# Obtain the module object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.apps().modules().patch(body=module, appsId=\"example-appsId\", modulesId=\"example-modulesId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for appengine.apps.modules.patch\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 // Obtain the Module object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = appengineService.Apps.Modules.Patch(module, \"example-appsId\", \"example-modulesId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/appengine.apps.modules.versions.create.snippet.json b/appengine.apps.modules.versions.create.snippet.json new file mode 100644 index 0000000..6fd5a99 --- /dev/null +++ b/appengine.apps.modules.versions.create.snippet.json @@ -0,0 +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,"csharp":"// 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}} diff --git a/appengine.apps.modules.versions.delete.snippet.json b/appengine.apps.modules.versions.delete.snippet.json new file mode 100644 index 0000000..29f9285 --- /dev/null +++ b/appengine.apps.modules.versions.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"appengine","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for appengine.apps.modules.versions.delete\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\tAppengine.Apps.Modules.Versions.Delete request = appengineService.apps().modules().versions().delete(\"example-appsId\", \"example-modulesId\", \"example-versionsId\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for appengine.apps.modules.versions.delete\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\nservice.apps().modules().versions().delete(appsId=\"example-appsId\", modulesId=\"example-modulesId\", versionsId=\"example-versionsId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for appengine.apps.modules.versions.delete\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 request = appengineService.Apps.Modules.Versions.Delete(\"example-appsId\", \"example-modulesId\", \"example-versionsId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/appengine.apps.modules.versions.get.snippet.json b/appengine.apps.modules.versions.get.snippet.json new file mode 100644 index 0000000..73267ba --- /dev/null +++ b/appengine.apps.modules.versions.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"appengine","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for appengine.apps.modules.versions.get\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\tAppengine.Apps.Modules.Versions.Get request = appengineService.apps().modules().versions().get(\"example-appsId\", \"example-modulesId\", \"example-versionsId\");\r\n\t\tVersion response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for appengine.apps.modules.versions.get\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\nservice.apps().modules().versions().get(appsId=\"example-appsId\", modulesId=\"example-modulesId\", versionsId=\"example-versionsId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for appengine.apps.modules.versions.get\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 request = appengineService.Apps.Modules.Versions.Get(\"example-appsId\", \"example-modulesId\", \"example-versionsId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/appengine.apps.modules.versions.list.snippet.json b/appengine.apps.modules.versions.list.snippet.json new file mode 100644 index 0000000..949f23e --- /dev/null +++ b/appengine.apps.modules.versions.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"appengine","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for appengine.apps.modules.versions.list\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\tListVersionsResponse response;\r\n\t\tAppengine.Apps.Modules.Versions.List request = appengineService.apps().modules().versions().list(\"example-appsId\", \"example-modulesId\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getVersions() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Version item : response.getVersions()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for appengine.apps.modules.versions.list\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\nrequest = service.apps().modules().versions().list(appsId=\"example-appsId\", modulesId=\"example-modulesId\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.apps().modules().versions().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for appengine.apps.modules.versions.list\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 ListVersionsResponse response;\r\n var request = appengineService.Apps.Modules.Versions.List(\"example-appsId\", \"example-modulesId\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Versions == null)\r\n continue;\r\n\r\n foreach (var item in response.Versions)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/appengine.apps.operations.get.snippet.json b/appengine.apps.operations.get.snippet.json new file mode 100644 index 0000000..6118292 --- /dev/null +++ b/appengine.apps.operations.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"appengine","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for appengine.apps.operations.get\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\tAppengine.Apps.Operations.Get request = appengineService.apps().operations().get(\"example-appsId\", \"example-operationsId\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for appengine.apps.operations.get\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\nservice.apps().operations().get(appsId=\"example-appsId\", operationsId=\"example-operationsId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for appengine.apps.operations.get\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 request = appengineService.Apps.Operations.Get(\"example-appsId\", \"example-operationsId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/appengine.apps.operations.list.snippet.json b/appengine.apps.operations.list.snippet.json new file mode 100644 index 0000000..239f4a0 --- /dev/null +++ b/appengine.apps.operations.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"appengine","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for appengine.apps.operations.list\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\tListOperationsResponse response;\r\n\t\tAppengine.Apps.Operations.List request = appengineService.apps().operations().list(\"example-appsId\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getOperations() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Operation item : response.getOperations()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for appengine.apps.operations.list\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\nrequest = service.apps().operations().list(appsId=\"example-appsId\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.apps().operations().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for appengine.apps.operations.list\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 ListOperationsResponse response;\r\n var request = appengineService.Apps.Operations.List(\"example-appsId\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Operations == null)\r\n continue;\r\n\r\n foreach (var item in response.Operations)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/autoscaler.autoscalers.delete.snippet.json b/autoscaler.autoscalers.delete.snippet.json new file mode 100644 index 0000000..38c9b47 --- /dev/null +++ b/autoscaler.autoscalers.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"autoscaler","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for autoscaler.autoscalers.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/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/autoscaler/v1beta2/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.autoscaler.Autoscaler;\r\nimport com.google.api.services.autoscaler.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class AutoscalerSample {\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\tAutoscaler autoscalerService = new Autoscaler.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\tAutoscaler.Autoscalers.Delete request = autoscalerService.autoscalers().delete(\"example-project\", \"us-central1-a\", \"example-autoscaler\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for autoscaler.autoscalers.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable autoscaler Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/autoscaler/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 'autoscaler' service, at version 'v1beta2'.\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('autoscaler', 'v1beta2', credentials=credentials)\r\n\r\nservice.autoscalers().delete(project=\"example-project\", zone=\"us-central1-a\", autoscaler=\"example-autoscaler\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for autoscaler.autoscalers.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.autoscaler.v1beta2\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.Autoscaler.v1beta2;\r\nusing Google.Apis.Autoscaler.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass AutoscalerSample\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 autoscalerService = new AutoscalerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = autoscalerService.Autoscalers.Delete(\"example-project\", \"us-central1-a\", \"example-autoscaler\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/autoscaler.autoscalers.get.snippet.json b/autoscaler.autoscalers.get.snippet.json new file mode 100644 index 0000000..370eca5 --- /dev/null +++ b/autoscaler.autoscalers.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"autoscaler","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for autoscaler.autoscalers.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/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/autoscaler/v1beta2/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.autoscaler.Autoscaler;\r\nimport com.google.api.services.autoscaler.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class AutoscalerSample {\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\tAutoscaler autoscalerService = new Autoscaler.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\tAutoscaler.Autoscalers.Get request = autoscalerService.autoscalers().get(\"example-project\", \"us-central1-a\", \"example-autoscaler\");\r\n\t\tAutoscaler response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for autoscaler.autoscalers.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable autoscaler Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/autoscaler/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 'autoscaler' service, at version 'v1beta2'.\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('autoscaler', 'v1beta2', credentials=credentials)\r\n\r\nservice.autoscalers().get(project=\"example-project\", zone=\"us-central1-a\", autoscaler=\"example-autoscaler\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for autoscaler.autoscalers.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.autoscaler.v1beta2\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.Autoscaler.v1beta2;\r\nusing Google.Apis.Autoscaler.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass AutoscalerSample\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 autoscalerService = new AutoscalerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = autoscalerService.Autoscalers.Get(\"example-project\", \"us-central1-a\", \"example-autoscaler\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/autoscaler.autoscalers.insert.snippet.json b/autoscaler.autoscalers.insert.snippet.json new file mode 100644 index 0000000..51b0ab5 --- /dev/null +++ b/autoscaler.autoscalers.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"autoscaler","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for autoscaler.autoscalers.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/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/autoscaler/v1beta2/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.autoscaler.Autoscaler;\r\nimport com.google.api.services.autoscaler.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class AutoscalerSample {\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\tAutoscaler autoscalerService = new Autoscaler.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\tcom.google.api.services.autoscaler.model.Autoscaler autoscaler = new com.google.api.services.autoscaler.model.Autoscaler();\r\n\t\t// Add your code to populate the autoscaler object\r\n\t\tAutoscaler.Autoscalers.Insert call = autoscalerService.autoscalers().insert(\"example-project\", \"us-central1-a\", autoscaler);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for autoscaler.autoscalers.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable autoscaler Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/autoscaler/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 'autoscaler' service, at version 'v1beta2'.\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('autoscaler', 'v1beta2', credentials=credentials)\r\n\r\nautoscaler = {} # construct your object here\r\nrequest = service.autoscalers().insert(body=autoscaler, project=\"example-project\", zone=\"us-central1-a\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for autoscaler.autoscalers.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.autoscaler.v1beta2\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.Autoscaler.v1beta2;\r\nusing Google.Apis.Autoscaler.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass AutoscalerSample\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 autoscalerService = new AutoscalerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var autoscaler = new Autoscaler();\r\n // Add your code to populate the autoscaler object\r\n var call = autoscalerService.Autoscalers.Insert(autoscaler, \"example-project\", \"us-central1-a\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/autoscaler.autoscalers.list.snippet.json b/autoscaler.autoscalers.list.snippet.json new file mode 100644 index 0000000..1a19e4c --- /dev/null +++ b/autoscaler.autoscalers.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"autoscaler","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for autoscaler.autoscalers.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/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/autoscaler/v1beta2/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.autoscaler.Autoscaler;\r\nimport com.google.api.services.autoscaler.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class AutoscalerSample {\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\tAutoscaler autoscalerService = new Autoscaler.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\tAutoscalerListResponse response;\r\n\t\tAutoscaler.Autoscalers.List request = autoscalerService.autoscalers().list(\"example-project\", \"us-central1-a\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Autoscaler item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for autoscaler.autoscalers.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable autoscaler Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/autoscaler/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 'autoscaler' service, at version 'v1beta2'.\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('autoscaler', 'v1beta2', credentials=credentials)\r\n\r\nrequest = service.autoscalers().list(project=\"example-project\", zone=\"us-central1-a\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.autoscalers().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for autoscaler.autoscalers.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.autoscaler.v1beta2\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.Autoscaler.v1beta2;\r\nusing Google.Apis.Autoscaler.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass AutoscalerSample\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 autoscalerService = new AutoscalerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n AutoscalerListResponse response;\r\n var request = autoscalerService.Autoscalers.List(\"example-project\", \"us-central1-a\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/autoscaler.autoscalers.patch.snippet.json b/autoscaler.autoscalers.patch.snippet.json new file mode 100644 index 0000000..fd5873f --- /dev/null +++ b/autoscaler.autoscalers.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"autoscaler","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for autoscaler.autoscalers.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/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/autoscaler/v1beta2/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.autoscaler.Autoscaler;\r\nimport com.google.api.services.autoscaler.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class AutoscalerSample {\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\tAutoscaler autoscalerService = new Autoscaler.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\t// Obtain the Autoscaler object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tAutoscaler.Autoscalers.Patch request = autoscalerService.autoscalers().patch(\"example-project\", \"us-central1-a\", \"example-autoscaler\", autoscaler);\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for autoscaler.autoscalers.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable autoscaler Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/autoscaler/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 'autoscaler' service, at version 'v1beta2'.\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('autoscaler', 'v1beta2', credentials=credentials)\r\n\r\n# Obtain the autoscaler object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.autoscalers().patch(body=autoscaler, project=\"example-project\", zone=\"us-central1-a\", autoscaler=\"example-autoscaler\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for autoscaler.autoscalers.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.autoscaler.v1beta2\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.Autoscaler.v1beta2;\r\nusing Google.Apis.Autoscaler.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass AutoscalerSample\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 autoscalerService = new AutoscalerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the Autoscaler object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = autoscalerService.Autoscalers.Patch(autoscaler, \"example-project\", \"us-central1-a\", \"example-autoscaler\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/autoscaler.autoscalers.update.snippet.json b/autoscaler.autoscalers.update.snippet.json new file mode 100644 index 0000000..32b07f4 --- /dev/null +++ b/autoscaler.autoscalers.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"autoscaler","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for autoscaler.autoscalers.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/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/autoscaler/v1beta2/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.autoscaler.Autoscaler;\r\nimport com.google.api.services.autoscaler.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class AutoscalerSample {\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\tAutoscaler autoscalerService = new Autoscaler.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\tcom.google.api.services.autoscaler.model.Autoscaler autoscaler = new com.google.api.services.autoscaler.model.Autoscaler();\r\n\t\t// Add your code to populate the autoscaler object\r\n\t\tAutoscaler.Autoscalers.Update call = autoscalerService.autoscalers().update(\"example-project\", \"us-central1-a\", \"example-autoscaler\", autoscaler);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for autoscaler.autoscalers.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable autoscaler Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/autoscaler/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 'autoscaler' service, at version 'v1beta2'.\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('autoscaler', 'v1beta2', credentials=credentials)\r\n\r\nautoscaler = {} # construct your object here\r\nrequest = service.autoscalers().update(body=autoscaler, project=\"example-project\", zone=\"us-central1-a\", autoscaler=\"example-autoscaler\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for autoscaler.autoscalers.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.autoscaler.v1beta2\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.Autoscaler.v1beta2;\r\nusing Google.Apis.Autoscaler.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass AutoscalerSample\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 autoscalerService = new AutoscalerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var autoscaler = new Autoscaler();\r\n // Add your code to populate the autoscaler object\r\n var call = autoscalerService.Autoscalers.Update(autoscaler, \"example-project\", \"us-central1-a\", \"example-autoscaler\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/autoscaler.zoneOperations.delete.snippet.json b/autoscaler.zoneOperations.delete.snippet.json new file mode 100644 index 0000000..a817312 --- /dev/null +++ b/autoscaler.zoneOperations.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"autoscaler","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for autoscaler.zoneOperations.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/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/autoscaler/v1beta2/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.autoscaler.Autoscaler;\r\nimport com.google.api.services.autoscaler.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class AutoscalerSample {\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\tAutoscaler autoscalerService = new Autoscaler.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\tAutoscaler.ZoneOperations.Delete request = autoscalerService.zoneOperations().delete(\"example-project\", \"us-central1-a\", \"example-operation\");\r\n\t\t response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for autoscaler.zoneOperations.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable autoscaler Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/autoscaler/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 'autoscaler' service, at version 'v1beta2'.\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('autoscaler', 'v1beta2', credentials=credentials)\r\n\r\nservice.zoneOperations().delete(project=\"example-project\", zone=\"us-central1-a\", operation=\"example-operation\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for autoscaler.zoneOperations.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.autoscaler.v1beta2\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.Autoscaler.v1beta2;\r\nusing Google.Apis.Autoscaler.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass AutoscalerSample\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 autoscalerService = new AutoscalerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = autoscalerService.ZoneOperations.Delete(\"example-project\", \"us-central1-a\", \"example-operation\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/autoscaler.zoneOperations.get.snippet.json b/autoscaler.zoneOperations.get.snippet.json new file mode 100644 index 0000000..ff9122f --- /dev/null +++ b/autoscaler.zoneOperations.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"autoscaler","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for autoscaler.zoneOperations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/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/autoscaler/v1beta2/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.autoscaler.Autoscaler;\r\nimport com.google.api.services.autoscaler.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class AutoscalerSample {\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\tAutoscaler autoscalerService = new Autoscaler.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\tAutoscaler.ZoneOperations.Get request = autoscalerService.zoneOperations().get(\"example-project\", \"us-central1-a\", \"example-operation\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for autoscaler.zoneOperations.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable autoscaler Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/autoscaler/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 'autoscaler' service, at version 'v1beta2'.\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('autoscaler', 'v1beta2', credentials=credentials)\r\n\r\nservice.zoneOperations().get(project=\"example-project\", zone=\"us-central1-a\", operation=\"example-operation\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for autoscaler.zoneOperations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.autoscaler.v1beta2\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.Autoscaler.v1beta2;\r\nusing Google.Apis.Autoscaler.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass AutoscalerSample\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 autoscalerService = new AutoscalerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = autoscalerService.ZoneOperations.Get(\"example-project\", \"us-central1-a\", \"example-operation\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/autoscaler.zoneOperations.list.snippet.json b/autoscaler.zoneOperations.list.snippet.json new file mode 100644 index 0000000..f2e91c7 --- /dev/null +++ b/autoscaler.zoneOperations.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"autoscaler","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for autoscaler.zoneOperations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/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/autoscaler/v1beta2/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.autoscaler.Autoscaler;\r\nimport com.google.api.services.autoscaler.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class AutoscalerSample {\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\tAutoscaler autoscalerService = new Autoscaler.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\tOperationList response;\r\n\t\tAutoscaler.ZoneOperations.List request = autoscalerService.zoneOperations().list(\"example-project\", \"us-central1-a\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Operation item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for autoscaler.zoneOperations.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable autoscaler Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/autoscaler/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 'autoscaler' service, at version 'v1beta2'.\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('autoscaler', 'v1beta2', credentials=credentials)\r\n\r\nrequest = service.zoneOperations().list(project=\"example-project\", zone=\"us-central1-a\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.zoneOperations().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for autoscaler.zoneOperations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.autoscaler.v1beta2\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.Autoscaler.v1beta2;\r\nusing Google.Apis.Autoscaler.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass AutoscalerSample\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 autoscalerService = new AutoscalerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n OperationList response;\r\n var request = autoscalerService.ZoneOperations.List(\"example-project\", \"us-central1-a\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/autoscaler.zones.list.snippet.json b/autoscaler.zones.list.snippet.json new file mode 100644 index 0000000..3abcd8e --- /dev/null +++ b/autoscaler.zones.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"autoscaler","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for autoscaler.zones.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/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/autoscaler/v1beta2/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.autoscaler.Autoscaler;\r\nimport com.google.api.services.autoscaler.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class AutoscalerSample {\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\tAutoscaler autoscalerService = new Autoscaler.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\tZoneList response;\r\n\t\tAutoscaler.Zones.List request = autoscalerService.zones().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Zone item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for autoscaler.zones.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable autoscaler Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/autoscaler/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 'autoscaler' service, at version 'v1beta2'.\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('autoscaler', 'v1beta2', credentials=credentials)\r\n\r\nrequest = service.zones().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.zones().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for autoscaler.zones.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable autoscaler Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/autoscaler/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.autoscaler.v1beta2\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.Autoscaler.v1beta2;\r\nusing Google.Apis.Autoscaler.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass AutoscalerSample\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 autoscalerService = new AutoscalerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ZoneList response;\r\n var request = autoscalerService.Zones.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.datasets.delete.snippet.json b/bigquery.datasets.delete.snippet.json new file mode 100644 index 0000000..a830309 --- /dev/null +++ b/bigquery.datasets.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.datasets.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tBigquery.Datasets.Delete request = bigqueryService.datasets().delete(\"example-project\", \"example-datasetId\");\r\n\t\t response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.datasets.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\nservice.datasets().delete(projectId=\"example-project\", datasetId=\"example-datasetId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.datasets.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = bigqueryService.Datasets.Delete(\"example-project\", \"example-datasetId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.datasets.get.snippet.json b/bigquery.datasets.get.snippet.json new file mode 100644 index 0000000..f850fae --- /dev/null +++ b/bigquery.datasets.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.datasets.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tBigquery.Datasets.Get request = bigqueryService.datasets().get(\"example-project\", \"example-datasetId\");\r\n\t\tDataset response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.datasets.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\nservice.datasets().get(projectId=\"example-project\", datasetId=\"example-datasetId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.datasets.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = bigqueryService.Datasets.Get(\"example-project\", \"example-datasetId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.datasets.insert.snippet.json b/bigquery.datasets.insert.snippet.json new file mode 100644 index 0000000..8d590c0 --- /dev/null +++ b/bigquery.datasets.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.datasets.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tDataset dataset = new Dataset();\r\n\t\t// Add your code to populate the dataset object\r\n\t\tBigquery.Datasets.Insert call = bigqueryService.datasets().insert(\"example-project\", dataset);\r\n\t\tDataset response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.datasets.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\ndataset = {} # construct your object here\r\nrequest = service.datasets().insert(body=dataset, projectId=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.datasets.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var dataset = new Dataset();\r\n // Add your code to populate the dataset object\r\n var call = bigqueryService.Datasets.Insert(dataset, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.datasets.list.snippet.json b/bigquery.datasets.list.snippet.json new file mode 100644 index 0000000..ed1d101 --- /dev/null +++ b/bigquery.datasets.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.datasets.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tDatasetList response;\r\n\t\tBigquery.Datasets.List request = bigqueryService.datasets().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getDatasets() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Object item : response.getDatasets()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.datasets.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\nrequest = service.datasets().list(projectId=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.datasets().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.datasets.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n DatasetList response;\r\n var request = bigqueryService.Datasets.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Datasets == null)\r\n continue;\r\n\r\n foreach (var item in response.Datasets)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.datasets.patch.snippet.json b/bigquery.datasets.patch.snippet.json new file mode 100644 index 0000000..1300767 --- /dev/null +++ b/bigquery.datasets.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.datasets.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\t// Obtain the Dataset object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tBigquery.Datasets.Patch request = bigqueryService.datasets().patch(\"example-project\", \"example-datasetId\", dataset);\r\n\t\tDataset response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.datasets.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\n# Obtain the dataset object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.datasets().patch(body=dataset, projectId=\"example-project\", datasetId=\"example-datasetId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.datasets.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the Dataset object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = bigqueryService.Datasets.Patch(dataset, \"example-project\", \"example-datasetId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.datasets.update.snippet.json b/bigquery.datasets.update.snippet.json new file mode 100644 index 0000000..0361de6 --- /dev/null +++ b/bigquery.datasets.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.datasets.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tDataset dataset = new Dataset();\r\n\t\t// Add your code to populate the dataset object\r\n\t\tBigquery.Datasets.Update call = bigqueryService.datasets().update(\"example-project\", \"example-datasetId\", dataset);\r\n\t\tDataset response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.datasets.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\ndataset = {} # construct your object here\r\nrequest = service.datasets().update(body=dataset, projectId=\"example-project\", datasetId=\"example-datasetId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.datasets.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var dataset = new Dataset();\r\n // Add your code to populate the dataset object\r\n var call = bigqueryService.Datasets.Update(dataset, \"example-project\", \"example-datasetId\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.jobs.cancel.snippet.json b/bigquery.jobs.cancel.snippet.json new file mode 100644 index 0000000..e48d753 --- /dev/null +++ b/bigquery.jobs.cancel.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.jobs.cancel\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tBigquery.Jobs.Cancel request = bigqueryService.jobs().cancel(\"example-project\", \"example-jobId\");\r\n\t\tJobCancelResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.jobs.cancel\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\nservice.jobs().cancel(projectId=\"example-project\", jobId=\"example-jobId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.jobs.cancel\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = bigqueryService.Jobs.Cancel(\"example-project\", \"example-jobId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.jobs.get.snippet.json b/bigquery.jobs.get.snippet.json new file mode 100644 index 0000000..81118d4 --- /dev/null +++ b/bigquery.jobs.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.jobs.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tBigquery.Jobs.Get request = bigqueryService.jobs().get(\"example-project\", \"example-jobId\");\r\n\t\tJob response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.jobs.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\nservice.jobs().get(projectId=\"example-project\", jobId=\"example-jobId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.jobs.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = bigqueryService.Jobs.Get(\"example-project\", \"example-jobId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.jobs.getQueryResults.snippet.json b/bigquery.jobs.getQueryResults.snippet.json new file mode 100644 index 0000000..b44cc92 --- /dev/null +++ b/bigquery.jobs.getQueryResults.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.jobs.getQueryResults\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tGetQueryResultsResponse response;\r\n\t\tBigquery.Jobs.GetQueryResults request = bigqueryService.jobs().getQueryResults(\"example-project\", \"example-jobId\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getErrors() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (ErrorProto item : response.getErrors()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.jobs.getQueryResults\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\nrequest = service.jobs().getQueryResults(projectId=\"example-project\", jobId=\"example-jobId\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.jobs().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.jobs.getQueryResults\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n GetQueryResultsResponse response;\r\n var request = bigqueryService.Jobs.GetQueryResults(\"example-project\", \"example-jobId\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Errors == null)\r\n continue;\r\n\r\n foreach (var item in response.Errors)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.jobs.insert.snippet.json b/bigquery.jobs.insert.snippet.json new file mode 100644 index 0000000..345b3f4 --- /dev/null +++ b/bigquery.jobs.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.jobs.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tJob job = new Job();\r\n\t\t// Add your code to populate the job object\r\n\t\tBigquery.Jobs.Insert call = bigqueryService.jobs().insert(\"example-project\", job);\r\n\t\tJob response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.jobs.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\njob = {} # construct your object here\r\nrequest = service.jobs().insert(body=job, projectId=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.jobs.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var job = new Job();\r\n // Add your code to populate the job object\r\n var call = bigqueryService.Jobs.Insert(job, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.jobs.list.snippet.json b/bigquery.jobs.list.snippet.json new file mode 100644 index 0000000..245ff8c --- /dev/null +++ b/bigquery.jobs.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.jobs.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tJobList response;\r\n\t\tBigquery.Jobs.List request = bigqueryService.jobs().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getJobs() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Object item : response.getJobs()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.jobs.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\nrequest = service.jobs().list(projectId=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.jobs().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.jobs.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n JobList response;\r\n var request = bigqueryService.Jobs.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Jobs == null)\r\n continue;\r\n\r\n foreach (var item in response.Jobs)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.jobs.query.snippet.json b/bigquery.jobs.query.snippet.json new file mode 100644 index 0000000..e578263 --- /dev/null +++ b/bigquery.jobs.query.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.jobs.query\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tQueryRequest queryRequest = new QueryRequest();\r\n\t\t// Add your code to populate the queryRequest object\r\n\t\tBigquery.Jobs.Query call = bigqueryService.jobs().query(\"example-project\", queryRequest);\r\n\t\tQueryResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.jobs.query\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\nquery_request = {} # construct your object here\r\nrequest = service.jobs().query(body=query_request, projectId=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.jobs.query\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var queryRequest = new QueryRequest();\r\n // Add your code to populate the queryRequest object\r\n var call = bigqueryService.Jobs.Query(queryRequest, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.projects.list.snippet.json b/bigquery.projects.list.snippet.json new file mode 100644 index 0000000..29307cf --- /dev/null +++ b/bigquery.projects.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.projects.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tProjectList response;\r\n\t\tBigquery.Projects.List request = bigqueryService.projects().list();\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getProjects() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Object item : response.getProjects()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.projects.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\nrequest = service.projects().list()\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.projects().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.projects.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ProjectList response;\r\n var request = bigqueryService.Projects.List();\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Projects == null)\r\n continue;\r\n\r\n foreach (var item in response.Projects)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.tabledata.insertAll.snippet.json b/bigquery.tabledata.insertAll.snippet.json new file mode 100644 index 0000000..9dd39d5 --- /dev/null +++ b/bigquery.tabledata.insertAll.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.tabledata.insertAll\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tTableDataInsertAllRequest tableDataInsertAllRequest = new TableDataInsertAllRequest();\r\n\t\t// Add your code to populate the tableDataInsertAllRequest object\r\n\t\tBigquery.Tabledata.InsertAll call = bigqueryService.tabledata().insertAll(\"example-project\", \"example-datasetId\", \"example-tableId\", tableDataInsertAllRequest);\r\n\t\tTableDataInsertAllResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.tabledata.insertAll\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\ntable_data_insert_all_request = {} # construct your object here\r\nrequest = service.tabledata().insertAll(body=table_data_insert_all_request, projectId=\"example-project\", datasetId=\"example-datasetId\", tableId=\"example-tableId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.tabledata.insertAll\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var tableDataInsertAllRequest = new TableDataInsertAllRequest();\r\n // Add your code to populate the tableDataInsertAllRequest object\r\n var call = bigqueryService.Tabledata.InsertAll(tableDataInsertAllRequest, \"example-project\", \"example-datasetId\", \"example-tableId\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.tabledata.list.snippet.json b/bigquery.tabledata.list.snippet.json new file mode 100644 index 0000000..027ed6d --- /dev/null +++ b/bigquery.tabledata.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.tabledata.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tTableDataList response;\r\n\t\tBigquery.Tabledata.List request = bigqueryService.tabledata().list(\"example-project\", \"example-datasetId\", \"example-tableId\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getRows() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (TableRow item : response.getRows()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.tabledata.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\nrequest = service.tabledata().list(projectId=\"example-project\", datasetId=\"example-datasetId\", tableId=\"example-tableId\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.tabledata().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.tabledata.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n TableDataList response;\r\n var request = bigqueryService.Tabledata.List(\"example-project\", \"example-datasetId\", \"example-tableId\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Rows == null)\r\n continue;\r\n\r\n foreach (var item in response.Rows)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.tables.delete.snippet.json b/bigquery.tables.delete.snippet.json new file mode 100644 index 0000000..c83cca4 --- /dev/null +++ b/bigquery.tables.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.tables.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tBigquery.Tables.Delete request = bigqueryService.tables().delete(\"example-project\", \"example-datasetId\", \"example-tableId\");\r\n\t\t response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.tables.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\nservice.tables().delete(projectId=\"example-project\", datasetId=\"example-datasetId\", tableId=\"example-tableId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.tables.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = bigqueryService.Tables.Delete(\"example-project\", \"example-datasetId\", \"example-tableId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.tables.get.snippet.json b/bigquery.tables.get.snippet.json new file mode 100644 index 0000000..ad19775 --- /dev/null +++ b/bigquery.tables.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.tables.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tBigquery.Tables.Get request = bigqueryService.tables().get(\"example-project\", \"example-datasetId\", \"example-tableId\");\r\n\t\tTable response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.tables.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\nservice.tables().get(projectId=\"example-project\", datasetId=\"example-datasetId\", tableId=\"example-tableId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.tables.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = bigqueryService.Tables.Get(\"example-project\", \"example-datasetId\", \"example-tableId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.tables.insert.snippet.json b/bigquery.tables.insert.snippet.json new file mode 100644 index 0000000..d94cbd9 --- /dev/null +++ b/bigquery.tables.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.tables.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tTable table = new Table();\r\n\t\t// Add your code to populate the table object\r\n\t\tBigquery.Tables.Insert call = bigqueryService.tables().insert(\"example-project\", \"example-datasetId\", table);\r\n\t\tTable response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.tables.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\ntable = {} # construct your object here\r\nrequest = service.tables().insert(body=table, projectId=\"example-project\", datasetId=\"example-datasetId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.tables.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var table = new Table();\r\n // Add your code to populate the table object\r\n var call = bigqueryService.Tables.Insert(table, \"example-project\", \"example-datasetId\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.tables.list.snippet.json b/bigquery.tables.list.snippet.json new file mode 100644 index 0000000..d30ea69 --- /dev/null +++ b/bigquery.tables.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.tables.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tTableList response;\r\n\t\tBigquery.Tables.List request = bigqueryService.tables().list(\"example-project\", \"example-datasetId\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getTables() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Object item : response.getTables()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.tables.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\nrequest = service.tables().list(projectId=\"example-project\", datasetId=\"example-datasetId\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.tables().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.tables.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n TableList response;\r\n var request = bigqueryService.Tables.List(\"example-project\", \"example-datasetId\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Tables == null)\r\n continue;\r\n\r\n foreach (var item in response.Tables)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.tables.patch.snippet.json b/bigquery.tables.patch.snippet.json new file mode 100644 index 0000000..25f581b --- /dev/null +++ b/bigquery.tables.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.tables.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\t// Obtain the Table object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tBigquery.Tables.Patch request = bigqueryService.tables().patch(\"example-project\", \"example-datasetId\", \"example-tableId\", table);\r\n\t\tTable response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.tables.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\n# Obtain the table object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.tables().patch(body=table, projectId=\"example-project\", datasetId=\"example-datasetId\", tableId=\"example-tableId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.tables.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the Table object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = bigqueryService.Tables.Patch(table, \"example-project\", \"example-datasetId\", \"example-tableId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/bigquery.tables.update.snippet.json b/bigquery.tables.update.snippet.json new file mode 100644 index 0000000..8fb751f --- /dev/null +++ b/bigquery.tables.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"bigquery","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for bigquery.tables.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/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/bigquery/v2/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.bigquery.Bigquery;\r\nimport com.google.api.services.bigquery.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class BigquerySample {\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\tBigquery bigqueryService = new Bigquery.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\tTable table = new Table();\r\n\t\t// Add your code to populate the table object\r\n\t\tBigquery.Tables.Update call = bigqueryService.tables().update(\"example-project\", \"example-datasetId\", \"example-tableId\", table);\r\n\t\tTable response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for bigquery.tables.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable bigquery Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/bigquery/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 'bigquery' service, at version 'v2'.\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('bigquery', 'v2', credentials=credentials)\r\n\r\ntable = {} # construct your object here\r\nrequest = service.tables().update(body=table, projectId=\"example-project\", datasetId=\"example-datasetId\", tableId=\"example-tableId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for bigquery.tables.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable bigquery Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/bigquery/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.bigquery.v2\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.Bigquery.v2;\r\nusing Google.Apis.Bigquery.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass BigquerySample\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 bigqueryService = new BigqueryService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var table = new Table();\r\n // Add your code to populate the table object\r\n var call = bigqueryService.Tables.Update(table, \"example-project\", \"example-datasetId\", \"example-tableId\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudbilling.billingAccounts.get.snippet.json b/cloudbilling.billingAccounts.get.snippet.json new file mode 100644 index 0000000..bf62585 --- /dev/null +++ b/cloudbilling.billingAccounts.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudbilling","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudbilling.billingAccounts.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudbilling Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudbilling/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/cloudbilling/v1/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.cloudbilling.Cloudbilling;\r\nimport com.google.api.services.cloudbilling.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudbillingSample {\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\tCloudbilling cloudbillingService = new Cloudbilling.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\tCloudbilling.BillingAccounts.Get request = cloudbillingService.billingAccounts().get(\"billingAccounts/example-billingAccount\");\r\n\t\tBillingAccount response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudbilling.billingAccounts.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudbilling Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudbilling/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 'cloudbilling' service, at version 'v1'.\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('cloudbilling', 'v1', credentials=credentials)\r\n\r\nservice.billingAccounts().get(name=\"billingAccounts/example-billingAccount\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudbilling.billingAccounts.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudbilling Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudbilling/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudbilling.v1\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.Cloudbilling.v1;\r\nusing Google.Apis.Cloudbilling.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudbillingSample\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 cloudbillingService = new CloudbillingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = cloudbillingService.BillingAccounts.Get(\"billingAccounts/example-billingAccount\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudbilling.billingAccounts.list.snippet.json b/cloudbilling.billingAccounts.list.snippet.json new file mode 100644 index 0000000..1b26c5d --- /dev/null +++ b/cloudbilling.billingAccounts.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudbilling","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudbilling.billingAccounts.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudbilling Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudbilling/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/cloudbilling/v1/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.cloudbilling.Cloudbilling;\r\nimport com.google.api.services.cloudbilling.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudbillingSample {\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\tCloudbilling cloudbillingService = new Cloudbilling.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\tListBillingAccountsResponse response;\r\n\t\tCloudbilling.BillingAccounts.List request = cloudbillingService.billingAccounts().list();\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getBillingAccounts() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (BillingAccount item : response.getBillingAccounts()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for cloudbilling.billingAccounts.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudbilling Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudbilling/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 'cloudbilling' service, at version 'v1'.\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('cloudbilling', 'v1', credentials=credentials)\r\n\r\nrequest = service.billingAccounts().list()\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.billingAccounts().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudbilling.billingAccounts.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudbilling Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudbilling/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudbilling.v1\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.Cloudbilling.v1;\r\nusing Google.Apis.Cloudbilling.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudbillingSample\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 cloudbillingService = new CloudbillingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListBillingAccountsResponse response;\r\n var request = cloudbillingService.BillingAccounts.List();\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.BillingAccounts == null)\r\n continue;\r\n\r\n foreach (var item in response.BillingAccounts)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudbilling.billingAccounts.projects.list.snippet.json b/cloudbilling.billingAccounts.projects.list.snippet.json new file mode 100644 index 0000000..20a82c7 --- /dev/null +++ b/cloudbilling.billingAccounts.projects.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudbilling","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudbilling.billingAccounts.projects.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudbilling Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudbilling/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/cloudbilling/v1/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.cloudbilling.Cloudbilling;\r\nimport com.google.api.services.cloudbilling.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudbillingSample {\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\tCloudbilling cloudbillingService = new Cloudbilling.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\tListProjectBillingInfoResponse response;\r\n\t\tCloudbilling.BillingAccounts.Projects.List request = cloudbillingService.billingAccounts().projects().list(\"billingAccounts/example-billingAccount\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getProjectBillingInfo() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (ProjectBillingInfo item : response.getProjectBillingInfo()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for cloudbilling.billingAccounts.projects.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudbilling Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudbilling/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 'cloudbilling' service, at version 'v1'.\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('cloudbilling', 'v1', credentials=credentials)\r\n\r\nrequest = service.billingAccounts().projects().list(name=\"billingAccounts/example-billingAccount\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.billingAccounts().projects().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudbilling.billingAccounts.projects.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudbilling Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudbilling/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudbilling.v1\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.Cloudbilling.v1;\r\nusing Google.Apis.Cloudbilling.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudbillingSample\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 cloudbillingService = new CloudbillingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListProjectBillingInfoResponse response;\r\n var request = cloudbillingService.BillingAccounts.Projects.List(\"billingAccounts/example-billingAccount\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.ProjectBillingInfo == null)\r\n continue;\r\n\r\n foreach (var item in response.ProjectBillingInfo)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudbilling.projects.getBillingInfo.snippet.json b/cloudbilling.projects.getBillingInfo.snippet.json new file mode 100644 index 0000000..ae6b0f3 --- /dev/null +++ b/cloudbilling.projects.getBillingInfo.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudbilling","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudbilling.projects.getBillingInfo\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudbilling Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudbilling/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/cloudbilling/v1/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.cloudbilling.Cloudbilling;\r\nimport com.google.api.services.cloudbilling.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudbillingSample {\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\tCloudbilling cloudbillingService = new Cloudbilling.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\tCloudbilling.Projects.GetBillingInfo request = cloudbillingService.projects().getBillingInfo(\"projects/example-project\");\r\n\t\tProjectBillingInfo response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudbilling.projects.getBillingInfo\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudbilling Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudbilling/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 'cloudbilling' service, at version 'v1'.\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('cloudbilling', 'v1', credentials=credentials)\r\n\r\nservice.projects().getBillingInfo(name=\"projects/example-project\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudbilling.projects.getBillingInfo\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudbilling Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudbilling/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudbilling.v1\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.Cloudbilling.v1;\r\nusing Google.Apis.Cloudbilling.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudbillingSample\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 cloudbillingService = new CloudbillingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = cloudbillingService.Projects.GetBillingInfo(\"projects/example-project\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudbilling.projects.updateBillingInfo.snippet.json b/cloudbilling.projects.updateBillingInfo.snippet.json new file mode 100644 index 0000000..d93f292 --- /dev/null +++ b/cloudbilling.projects.updateBillingInfo.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudbilling","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudbilling.projects.updateBillingInfo\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudbilling Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudbilling/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/cloudbilling/v1/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.cloudbilling.Cloudbilling;\r\nimport com.google.api.services.cloudbilling.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudbillingSample {\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\tCloudbilling cloudbillingService = new Cloudbilling.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\tProjectBillingInfo projectBillingInfo = new ProjectBillingInfo();\r\n\t\t// Add your code to populate the projectBillingInfo object\r\n\t\tCloudbilling.Projects.UpdateBillingInfo call = cloudbillingService.projects().updateBillingInfo(\"projects/example-project\", projectBillingInfo);\r\n\t\tProjectBillingInfo response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudbilling.projects.updateBillingInfo\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudbilling Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudbilling/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 'cloudbilling' service, at version 'v1'.\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('cloudbilling', 'v1', credentials=credentials)\r\n\r\nproject_billing_info = {} # construct your object here\r\nrequest = service.projects().updateBillingInfo(body=project_billing_info, name=\"projects/example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudbilling.projects.updateBillingInfo\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudbilling Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudbilling/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudbilling.v1\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.Cloudbilling.v1;\r\nusing Google.Apis.Cloudbilling.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudbillingSample\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 cloudbillingService = new CloudbillingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var projectBillingInfo = new ProjectBillingInfo();\r\n // Add your code to populate the projectBillingInfo object\r\n var call = cloudbillingService.Projects.UpdateBillingInfo(projectBillingInfo, \"projects/example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouddebugger.controller.debuggees.breakpoints.list.snippet.json b/clouddebugger.controller.debuggees.breakpoints.list.snippet.json new file mode 100644 index 0000000..db466c3 --- /dev/null +++ b/clouddebugger.controller.debuggees.breakpoints.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouddebugger","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouddebugger.controller.debuggees.breakpoints.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouddebugger/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/clouddebugger/v2/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.clouddebugger.Clouddebugger;\r\nimport com.google.api.services.clouddebugger.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouddebuggerSample {\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\tClouddebugger clouddebuggerService = new Clouddebugger.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\tClouddebugger.Controller.Debuggees.Breakpoints.List request = clouddebuggerService.controller().debuggees().breakpoints().list(\"example-debuggeeId\");\r\n\t\tListActiveBreakpointsResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouddebugger.controller.debuggees.breakpoints.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouddebugger/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 'clouddebugger' service, at version 'v2'.\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('clouddebugger', 'v2', credentials=credentials)\r\n\r\nservice.controller().debuggees().breakpoints().list(debuggeeId=\"example-debuggeeId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouddebugger.controller.debuggees.breakpoints.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouddebugger/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouddebugger.v2\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.Clouddebugger.v2;\r\nusing Google.Apis.Clouddebugger.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouddebuggerSample\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 clouddebuggerService = new ClouddebuggerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = clouddebuggerService.Controller.Debuggees.Breakpoints.List(\"example-debuggeeId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouddebugger.controller.debuggees.breakpoints.update.snippet.json b/clouddebugger.controller.debuggees.breakpoints.update.snippet.json new file mode 100644 index 0000000..7cf1cd2 --- /dev/null +++ b/clouddebugger.controller.debuggees.breakpoints.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouddebugger","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouddebugger.controller.debuggees.breakpoints.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouddebugger/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/clouddebugger/v2/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.clouddebugger.Clouddebugger;\r\nimport com.google.api.services.clouddebugger.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouddebuggerSample {\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\tClouddebugger clouddebuggerService = new Clouddebugger.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\tUpdateActiveBreakpointRequest updateActiveBreakpointRequest = new UpdateActiveBreakpointRequest();\r\n\t\t// Add your code to populate the updateActiveBreakpointRequest object\r\n\t\tClouddebugger.Controller.Debuggees.Breakpoints.Update call = clouddebuggerService.controller().debuggees().breakpoints().update(\"example-debuggeeId\", \"example-id\", updateActiveBreakpointRequest);\r\n\t\tUpdateActiveBreakpointResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouddebugger.controller.debuggees.breakpoints.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouddebugger/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 'clouddebugger' service, at version 'v2'.\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('clouddebugger', 'v2', credentials=credentials)\r\n\r\nupdate_active_breakpoint_request = {} # construct your object here\r\nrequest = service.controller().debuggees().breakpoints().update(body=update_active_breakpoint_request, debuggeeId=\"example-debuggeeId\", id=\"example-id\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouddebugger.controller.debuggees.breakpoints.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouddebugger/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouddebugger.v2\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.Clouddebugger.v2;\r\nusing Google.Apis.Clouddebugger.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouddebuggerSample\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 clouddebuggerService = new ClouddebuggerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var updateActiveBreakpointRequest = new UpdateActiveBreakpointRequest();\r\n // Add your code to populate the updateActiveBreakpointRequest object\r\n var call = clouddebuggerService.Controller.Debuggees.Breakpoints.Update(updateActiveBreakpointRequest, \"example-debuggeeId\", \"example-id\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouddebugger.controller.debuggees.register.snippet.json b/clouddebugger.controller.debuggees.register.snippet.json new file mode 100644 index 0000000..5aa8de6 --- /dev/null +++ b/clouddebugger.controller.debuggees.register.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouddebugger","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouddebugger.controller.debuggees.register\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouddebugger/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/clouddebugger/v2/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.clouddebugger.Clouddebugger;\r\nimport com.google.api.services.clouddebugger.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouddebuggerSample {\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\tClouddebugger clouddebuggerService = new Clouddebugger.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\tRegisterDebuggeeRequest registerDebuggeeRequest = new RegisterDebuggeeRequest();\r\n\t\t// Add your code to populate the registerDebuggeeRequest object\r\n\t\tClouddebugger.Controller.Debuggees.Register call = clouddebuggerService.controller().debuggees().register(registerDebuggeeRequest);\r\n\t\tRegisterDebuggeeResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouddebugger.controller.debuggees.register\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouddebugger/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 'clouddebugger' service, at version 'v2'.\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('clouddebugger', 'v2', credentials=credentials)\r\n\r\nregister_debuggee_request = {} # construct your object here\r\nrequest = service.controller().debuggees().register(body=register_debuggee_request)\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouddebugger.controller.debuggees.register\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouddebugger/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouddebugger.v2\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.Clouddebugger.v2;\r\nusing Google.Apis.Clouddebugger.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouddebuggerSample\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 clouddebuggerService = new ClouddebuggerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var registerDebuggeeRequest = new RegisterDebuggeeRequest();\r\n // Add your code to populate the registerDebuggeeRequest object\r\n var call = clouddebuggerService.Controller.Debuggees.Register(registerDebuggeeRequest);\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouddebugger.debugger.debuggees.breakpoints.delete.snippet.json b/clouddebugger.debugger.debuggees.breakpoints.delete.snippet.json new file mode 100644 index 0000000..5f92d7d --- /dev/null +++ b/clouddebugger.debugger.debuggees.breakpoints.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouddebugger","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouddebugger.debugger.debuggees.breakpoints.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouddebugger/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/clouddebugger/v2/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.clouddebugger.Clouddebugger;\r\nimport com.google.api.services.clouddebugger.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouddebuggerSample {\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\tClouddebugger clouddebuggerService = new Clouddebugger.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\tClouddebugger.Debugger.Debuggees.Breakpoints.Delete request = clouddebuggerService.debugger().debuggees().breakpoints().delete(\"example-debuggeeId\", \"example-breakpointId\");\r\n\t\tEmpty response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouddebugger.debugger.debuggees.breakpoints.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouddebugger/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 'clouddebugger' service, at version 'v2'.\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('clouddebugger', 'v2', credentials=credentials)\r\n\r\nservice.debugger().debuggees().breakpoints().delete(debuggeeId=\"example-debuggeeId\", breakpointId=\"example-breakpointId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouddebugger.debugger.debuggees.breakpoints.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouddebugger/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouddebugger.v2\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.Clouddebugger.v2;\r\nusing Google.Apis.Clouddebugger.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouddebuggerSample\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 clouddebuggerService = new ClouddebuggerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = clouddebuggerService.Debugger.Debuggees.Breakpoints.Delete(\"example-debuggeeId\", \"example-breakpointId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouddebugger.debugger.debuggees.breakpoints.get.snippet.json b/clouddebugger.debugger.debuggees.breakpoints.get.snippet.json new file mode 100644 index 0000000..5d4e96e --- /dev/null +++ b/clouddebugger.debugger.debuggees.breakpoints.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouddebugger","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouddebugger.debugger.debuggees.breakpoints.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouddebugger/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/clouddebugger/v2/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.clouddebugger.Clouddebugger;\r\nimport com.google.api.services.clouddebugger.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouddebuggerSample {\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\tClouddebugger clouddebuggerService = new Clouddebugger.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\tClouddebugger.Debugger.Debuggees.Breakpoints.Get request = clouddebuggerService.debugger().debuggees().breakpoints().get(\"example-debuggeeId\", \"example-breakpointId\");\r\n\t\tGetBreakpointResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouddebugger.debugger.debuggees.breakpoints.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouddebugger/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 'clouddebugger' service, at version 'v2'.\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('clouddebugger', 'v2', credentials=credentials)\r\n\r\nservice.debugger().debuggees().breakpoints().get(debuggeeId=\"example-debuggeeId\", breakpointId=\"example-breakpointId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouddebugger.debugger.debuggees.breakpoints.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouddebugger/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouddebugger.v2\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.Clouddebugger.v2;\r\nusing Google.Apis.Clouddebugger.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouddebuggerSample\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 clouddebuggerService = new ClouddebuggerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = clouddebuggerService.Debugger.Debuggees.Breakpoints.Get(\"example-debuggeeId\", \"example-breakpointId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouddebugger.debugger.debuggees.breakpoints.list.snippet.json b/clouddebugger.debugger.debuggees.breakpoints.list.snippet.json new file mode 100644 index 0000000..7f4f425 --- /dev/null +++ b/clouddebugger.debugger.debuggees.breakpoints.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouddebugger","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouddebugger.debugger.debuggees.breakpoints.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouddebugger/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/clouddebugger/v2/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.clouddebugger.Clouddebugger;\r\nimport com.google.api.services.clouddebugger.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouddebuggerSample {\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\tClouddebugger clouddebuggerService = new Clouddebugger.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\tClouddebugger.Debugger.Debuggees.Breakpoints.List request = clouddebuggerService.debugger().debuggees().breakpoints().list(\"example-debuggeeId\");\r\n\t\tListBreakpointsResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouddebugger.debugger.debuggees.breakpoints.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouddebugger/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 'clouddebugger' service, at version 'v2'.\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('clouddebugger', 'v2', credentials=credentials)\r\n\r\nservice.debugger().debuggees().breakpoints().list(debuggeeId=\"example-debuggeeId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouddebugger.debugger.debuggees.breakpoints.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouddebugger/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouddebugger.v2\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.Clouddebugger.v2;\r\nusing Google.Apis.Clouddebugger.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouddebuggerSample\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 clouddebuggerService = new ClouddebuggerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = clouddebuggerService.Debugger.Debuggees.Breakpoints.List(\"example-debuggeeId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouddebugger.debugger.debuggees.breakpoints.set.snippet.json b/clouddebugger.debugger.debuggees.breakpoints.set.snippet.json new file mode 100644 index 0000000..ecd98c2 --- /dev/null +++ b/clouddebugger.debugger.debuggees.breakpoints.set.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouddebugger","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouddebugger.debugger.debuggees.breakpoints.set\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouddebugger/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/clouddebugger/v2/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.clouddebugger.Clouddebugger;\r\nimport com.google.api.services.clouddebugger.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouddebuggerSample {\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\tClouddebugger clouddebuggerService = new Clouddebugger.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\tBreakpoint breakpoint = new Breakpoint();\r\n\t\t// Add your code to populate the breakpoint object\r\n\t\tClouddebugger.Debugger.Debuggees.Breakpoints.Set call = clouddebuggerService.debugger().debuggees().breakpoints().set(\"example-debuggeeId\", breakpoint);\r\n\t\tSetBreakpointResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouddebugger.debugger.debuggees.breakpoints.set\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouddebugger/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 'clouddebugger' service, at version 'v2'.\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('clouddebugger', 'v2', credentials=credentials)\r\n\r\nbreakpoint = {} # construct your object here\r\nrequest = service.debugger().debuggees().breakpoints().set(body=breakpoint, debuggeeId=\"example-debuggeeId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouddebugger.debugger.debuggees.breakpoints.set\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouddebugger/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouddebugger.v2\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.Clouddebugger.v2;\r\nusing Google.Apis.Clouddebugger.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouddebuggerSample\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 clouddebuggerService = new ClouddebuggerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var breakpoint = new Breakpoint();\r\n // Add your code to populate the breakpoint object\r\n var call = clouddebuggerService.Debugger.Debuggees.Breakpoints.Set(breakpoint, \"example-debuggeeId\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouddebugger.debugger.debuggees.list.snippet.json b/clouddebugger.debugger.debuggees.list.snippet.json new file mode 100644 index 0000000..82b1575 --- /dev/null +++ b/clouddebugger.debugger.debuggees.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouddebugger","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouddebugger.debugger.debuggees.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouddebugger/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/clouddebugger/v2/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.clouddebugger.Clouddebugger;\r\nimport com.google.api.services.clouddebugger.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouddebuggerSample {\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\tClouddebugger clouddebuggerService = new Clouddebugger.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\tClouddebugger.Debugger.Debuggees.List request = clouddebuggerService.debugger().debuggees().list();\r\n\t\tListDebuggeesResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouddebugger.debugger.debuggees.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouddebugger/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 'clouddebugger' service, at version 'v2'.\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('clouddebugger', 'v2', credentials=credentials)\r\n\r\nservice.debugger().debuggees().list().execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouddebugger.debugger.debuggees.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouddebugger Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouddebugger/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouddebugger.v2\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.Clouddebugger.v2;\r\nusing Google.Apis.Clouddebugger.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouddebuggerSample\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 clouddebuggerService = new ClouddebuggerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = clouddebuggerService.Debugger.Debuggees.List();\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudmonitoring.metricDescriptors.create.snippet.json b/cloudmonitoring.metricDescriptors.create.snippet.json new file mode 100644 index 0000000..58600dd --- /dev/null +++ b/cloudmonitoring.metricDescriptors.create.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudmonitoring","apiVersion":"v2beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudmonitoring.metricDescriptors.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudmonitoring Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudmonitoring/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/cloudmonitoring/v2beta2/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.cloudmonitoring.Cloudmonitoring;\r\nimport com.google.api.services.cloudmonitoring.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudmonitoringSample {\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\tCloudmonitoring cloudmonitoringService = new Cloudmonitoring.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\tMetricDescriptor metricDescriptor = new MetricDescriptor();\r\n\t\t// Add your code to populate the metricDescriptor object\r\n\t\tCloudmonitoring.MetricDescriptors.Create call = cloudmonitoringService.metricDescriptors().create(\"example-project\", metricDescriptor);\r\n\t\tMetricDescriptor response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudmonitoring.metricDescriptors.create\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudmonitoring Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudmonitoring/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 'cloudmonitoring' service, at version 'v2beta2'.\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('cloudmonitoring', 'v2beta2', credentials=credentials)\r\n\r\nmetric_descriptor = {} # construct your object here\r\nrequest = service.metricDescriptors().create(body=metric_descriptor, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudmonitoring.metricDescriptors.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudmonitoring Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudmonitoring/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudmonitoring.v2beta2\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.Cloudmonitoring.v2beta2;\r\nusing Google.Apis.Cloudmonitoring.v2beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudmonitoringSample\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 cloudmonitoringService = new CloudmonitoringService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var metricDescriptor = new MetricDescriptor();\r\n // Add your code to populate the metricDescriptor object\r\n var call = cloudmonitoringService.MetricDescriptors.Create(metricDescriptor, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudmonitoring.metricDescriptors.delete.snippet.json b/cloudmonitoring.metricDescriptors.delete.snippet.json new file mode 100644 index 0000000..c2cead7 --- /dev/null +++ b/cloudmonitoring.metricDescriptors.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudmonitoring","apiVersion":"v2beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudmonitoring.metricDescriptors.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudmonitoring Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudmonitoring/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/cloudmonitoring/v2beta2/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.cloudmonitoring.Cloudmonitoring;\r\nimport com.google.api.services.cloudmonitoring.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudmonitoringSample {\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\tCloudmonitoring cloudmonitoringService = new Cloudmonitoring.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\tCloudmonitoring.MetricDescriptors.Delete request = cloudmonitoringService.metricDescriptors().delete(\"example-project\", \"example-metric\");\r\n\t\tDeleteMetricDescriptorResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudmonitoring.metricDescriptors.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudmonitoring Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudmonitoring/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 'cloudmonitoring' service, at version 'v2beta2'.\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('cloudmonitoring', 'v2beta2', credentials=credentials)\r\n\r\nservice.metricDescriptors().delete(project=\"example-project\", metric=\"example-metric\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudmonitoring.metricDescriptors.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudmonitoring Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudmonitoring/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudmonitoring.v2beta2\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.Cloudmonitoring.v2beta2;\r\nusing Google.Apis.Cloudmonitoring.v2beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudmonitoringSample\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 cloudmonitoringService = new CloudmonitoringService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = cloudmonitoringService.MetricDescriptors.Delete(\"example-project\", \"example-metric\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudmonitoring.metricDescriptors.list.snippet.json b/cloudmonitoring.metricDescriptors.list.snippet.json new file mode 100644 index 0000000..8d7bb79 --- /dev/null +++ b/cloudmonitoring.metricDescriptors.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudmonitoring","apiVersion":"v2beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudmonitoring.metricDescriptors.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudmonitoring Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudmonitoring/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/cloudmonitoring/v2beta2/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.cloudmonitoring.Cloudmonitoring;\r\nimport com.google.api.services.cloudmonitoring.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudmonitoringSample {\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\tCloudmonitoring cloudmonitoringService = new Cloudmonitoring.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\tListMetricDescriptorsResponse response;\r\n\t\tCloudmonitoring.MetricDescriptors.List request = cloudmonitoringService.metricDescriptors().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getMetrics() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (MetricDescriptor item : response.getMetrics()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for cloudmonitoring.metricDescriptors.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudmonitoring Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudmonitoring/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 'cloudmonitoring' service, at version 'v2beta2'.\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('cloudmonitoring', 'v2beta2', credentials=credentials)\r\n\r\nrequest = service.metricDescriptors().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.metricDescriptors().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudmonitoring.metricDescriptors.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudmonitoring Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudmonitoring/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudmonitoring.v2beta2\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.Cloudmonitoring.v2beta2;\r\nusing Google.Apis.Cloudmonitoring.v2beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudmonitoringSample\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 cloudmonitoringService = new CloudmonitoringService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListMetricDescriptorsResponse response;\r\n var request = cloudmonitoringService.MetricDescriptors.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Metrics == null)\r\n continue;\r\n\r\n foreach (var item in response.Metrics)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudmonitoring.timeseries.list.snippet.json b/cloudmonitoring.timeseries.list.snippet.json new file mode 100644 index 0000000..f2ddf03 --- /dev/null +++ b/cloudmonitoring.timeseries.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudmonitoring","apiVersion":"v2beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudmonitoring.timeseries.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudmonitoring Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudmonitoring/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/cloudmonitoring/v2beta2/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.cloudmonitoring.Cloudmonitoring;\r\nimport com.google.api.services.cloudmonitoring.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudmonitoringSample {\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\tCloudmonitoring cloudmonitoringService = new Cloudmonitoring.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\tListTimeseriesResponse response;\r\n\t\tCloudmonitoring.Timeseries.List request = cloudmonitoringService.timeseries().list(\"example-project\", \"example-metric\", \"example-youngest\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getTimeseries() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Timeseries item : response.getTimeseries()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for cloudmonitoring.timeseries.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudmonitoring Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudmonitoring/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 'cloudmonitoring' service, at version 'v2beta2'.\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('cloudmonitoring', 'v2beta2', credentials=credentials)\r\n\r\nrequest = service.timeseries().list(project=\"example-project\", metric=\"example-metric\", youngest=\"example-youngest\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.timeseries().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudmonitoring.timeseries.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudmonitoring Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudmonitoring/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudmonitoring.v2beta2\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.Cloudmonitoring.v2beta2;\r\nusing Google.Apis.Cloudmonitoring.v2beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudmonitoringSample\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 cloudmonitoringService = new CloudmonitoringService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListTimeseriesResponse response;\r\n var request = cloudmonitoringService.Timeseries.List(\"example-project\", \"example-metric\", \"example-youngest\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Timeseries == null)\r\n continue;\r\n\r\n foreach (var item in response.Timeseries)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudmonitoring.timeseries.write.snippet.json b/cloudmonitoring.timeseries.write.snippet.json new file mode 100644 index 0000000..2c628a5 --- /dev/null +++ b/cloudmonitoring.timeseries.write.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudmonitoring","apiVersion":"v2beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudmonitoring.timeseries.write\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudmonitoring Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudmonitoring/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/cloudmonitoring/v2beta2/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.cloudmonitoring.Cloudmonitoring;\r\nimport com.google.api.services.cloudmonitoring.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudmonitoringSample {\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\tCloudmonitoring cloudmonitoringService = new Cloudmonitoring.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\tWriteTimeseriesRequest writeTimeseriesRequest = new WriteTimeseriesRequest();\r\n\t\t// Add your code to populate the writeTimeseriesRequest object\r\n\t\tCloudmonitoring.Timeseries.Write call = cloudmonitoringService.timeseries().write(\"example-project\", writeTimeseriesRequest);\r\n\t\tWriteTimeseriesResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudmonitoring.timeseries.write\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudmonitoring Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudmonitoring/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 'cloudmonitoring' service, at version 'v2beta2'.\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('cloudmonitoring', 'v2beta2', credentials=credentials)\r\n\r\nwrite_timeseries_request = {} # construct your object here\r\nrequest = service.timeseries().write(body=write_timeseries_request, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudmonitoring.timeseries.write\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudmonitoring Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudmonitoring/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudmonitoring.v2beta2\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.Cloudmonitoring.v2beta2;\r\nusing Google.Apis.Cloudmonitoring.v2beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudmonitoringSample\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 cloudmonitoringService = new CloudmonitoringService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var writeTimeseriesRequest = new WriteTimeseriesRequest();\r\n // Add your code to populate the writeTimeseriesRequest object\r\n var call = cloudmonitoringService.Timeseries.Write(writeTimeseriesRequest, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudmonitoring.timeseriesDescriptors.list.snippet.json b/cloudmonitoring.timeseriesDescriptors.list.snippet.json new file mode 100644 index 0000000..f704486 --- /dev/null +++ b/cloudmonitoring.timeseriesDescriptors.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudmonitoring","apiVersion":"v2beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudmonitoring.timeseriesDescriptors.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudmonitoring Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudmonitoring/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/cloudmonitoring/v2beta2/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.cloudmonitoring.Cloudmonitoring;\r\nimport com.google.api.services.cloudmonitoring.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudmonitoringSample {\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\tCloudmonitoring cloudmonitoringService = new Cloudmonitoring.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\tListTimeseriesDescriptorsResponse response;\r\n\t\tCloudmonitoring.TimeseriesDescriptors.List request = cloudmonitoringService.timeseriesDescriptors().list(\"example-project\", \"example-metric\", \"example-youngest\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getTimeseries() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (TimeseriesDescriptor item : response.getTimeseries()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for cloudmonitoring.timeseriesDescriptors.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudmonitoring Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudmonitoring/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 'cloudmonitoring' service, at version 'v2beta2'.\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('cloudmonitoring', 'v2beta2', credentials=credentials)\r\n\r\nrequest = service.timeseriesDescriptors().list(project=\"example-project\", metric=\"example-metric\", youngest=\"example-youngest\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.timeseriesDescriptors().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudmonitoring.timeseriesDescriptors.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudmonitoring Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudmonitoring/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudmonitoring.v2beta2\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.Cloudmonitoring.v2beta2;\r\nusing Google.Apis.Cloudmonitoring.v2beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudmonitoringSample\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 cloudmonitoringService = new CloudmonitoringService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListTimeseriesDescriptorsResponse response;\r\n var request = cloudmonitoringService.TimeseriesDescriptors.List(\"example-project\", \"example-metric\", \"example-youngest\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Timeseries == null)\r\n continue;\r\n\r\n foreach (var item in response.Timeseries)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudresourcemanager.organizations.get.snippet.json b/cloudresourcemanager.organizations.get.snippet.json new file mode 100644 index 0000000..45377c5 --- /dev/null +++ b/cloudresourcemanager.organizations.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudresourcemanager","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudresourcemanager.organizations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/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/cloudresourcemanager/v1beta1/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.cloudresourcemanager.Cloudresourcemanager;\r\nimport com.google.api.services.cloudresourcemanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudresourcemanagerSample {\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\tCloudresourcemanager cloudresourcemanagerService = new Cloudresourcemanager.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\tCloudresourcemanager.Organizations.Get request = cloudresourcemanagerService.organizations().get(\"example-organizationId\");\r\n\t\tOrganization response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudresourcemanager.organizations.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudresourcemanager/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 'cloudresourcemanager' service, at version 'v1beta1'.\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('cloudresourcemanager', 'v1beta1', credentials=credentials)\r\n\r\nservice.organizations().get(organizationId=\"example-organizationId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudresourcemanager.organizations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudresourcemanager.v1beta1\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.Cloudresourcemanager.v1beta1;\r\nusing Google.Apis.Cloudresourcemanager.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudresourcemanagerSample\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 cloudresourcemanagerService = new CloudresourcemanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = cloudresourcemanagerService.Organizations.Get(\"example-organizationId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudresourcemanager.organizations.getIamPolicy.snippet.json b/cloudresourcemanager.organizations.getIamPolicy.snippet.json new file mode 100644 index 0000000..f87c531 --- /dev/null +++ b/cloudresourcemanager.organizations.getIamPolicy.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudresourcemanager","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudresourcemanager.organizations.getIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/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/cloudresourcemanager/v1beta1/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.cloudresourcemanager.Cloudresourcemanager;\r\nimport com.google.api.services.cloudresourcemanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudresourcemanagerSample {\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\tCloudresourcemanager cloudresourcemanagerService = new Cloudresourcemanager.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\tGetIamPolicyRequest getIamPolicyRequest = new GetIamPolicyRequest();\r\n\t\t// Add your code to populate the getIamPolicyRequest object\r\n\t\tCloudresourcemanager.Organizations.GetIamPolicy call = cloudresourcemanagerService.organizations().getIamPolicy(\"example-resource\", getIamPolicyRequest);\r\n\t\tPolicy response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudresourcemanager.organizations.getIamPolicy\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudresourcemanager/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 'cloudresourcemanager' service, at version 'v1beta1'.\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('cloudresourcemanager', 'v1beta1', credentials=credentials)\r\n\r\nget_iam_policy_request = {} # construct your object here\r\nrequest = service.organizations().getIamPolicy(body=get_iam_policy_request, resource=\"example-resource\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudresourcemanager.organizations.getIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudresourcemanager.v1beta1\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.Cloudresourcemanager.v1beta1;\r\nusing Google.Apis.Cloudresourcemanager.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudresourcemanagerSample\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 cloudresourcemanagerService = new CloudresourcemanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var getIamPolicyRequest = new GetIamPolicyRequest();\r\n // Add your code to populate the getIamPolicyRequest object\r\n var call = cloudresourcemanagerService.Organizations.GetIamPolicy(getIamPolicyRequest, \"example-resource\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudresourcemanager.organizations.list.snippet.json b/cloudresourcemanager.organizations.list.snippet.json new file mode 100644 index 0000000..b200697 --- /dev/null +++ b/cloudresourcemanager.organizations.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudresourcemanager","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudresourcemanager.organizations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/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/cloudresourcemanager/v1beta1/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.cloudresourcemanager.Cloudresourcemanager;\r\nimport com.google.api.services.cloudresourcemanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudresourcemanagerSample {\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\tCloudresourcemanager cloudresourcemanagerService = new Cloudresourcemanager.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\tListOrganizationsResponse response;\r\n\t\tCloudresourcemanager.Organizations.List request = cloudresourcemanagerService.organizations().list();\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getOrganizations() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Organization item : response.getOrganizations()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for cloudresourcemanager.organizations.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudresourcemanager/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 'cloudresourcemanager' service, at version 'v1beta1'.\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('cloudresourcemanager', 'v1beta1', credentials=credentials)\r\n\r\nrequest = service.organizations().list()\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.organizations().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudresourcemanager.organizations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudresourcemanager.v1beta1\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.Cloudresourcemanager.v1beta1;\r\nusing Google.Apis.Cloudresourcemanager.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudresourcemanagerSample\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 cloudresourcemanagerService = new CloudresourcemanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListOrganizationsResponse response;\r\n var request = cloudresourcemanagerService.Organizations.List();\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Organizations == null)\r\n continue;\r\n\r\n foreach (var item in response.Organizations)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudresourcemanager.organizations.setIamPolicy.snippet.json b/cloudresourcemanager.organizations.setIamPolicy.snippet.json new file mode 100644 index 0000000..95e13b7 --- /dev/null +++ b/cloudresourcemanager.organizations.setIamPolicy.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudresourcemanager","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudresourcemanager.organizations.setIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/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/cloudresourcemanager/v1beta1/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.cloudresourcemanager.Cloudresourcemanager;\r\nimport com.google.api.services.cloudresourcemanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudresourcemanagerSample {\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\tCloudresourcemanager cloudresourcemanagerService = new Cloudresourcemanager.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\tSetIamPolicyRequest setIamPolicyRequest = new SetIamPolicyRequest();\r\n\t\t// Add your code to populate the setIamPolicyRequest object\r\n\t\tCloudresourcemanager.Organizations.SetIamPolicy call = cloudresourcemanagerService.organizations().setIamPolicy(\"example-resource\", setIamPolicyRequest);\r\n\t\tPolicy response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudresourcemanager.organizations.setIamPolicy\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudresourcemanager/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 'cloudresourcemanager' service, at version 'v1beta1'.\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('cloudresourcemanager', 'v1beta1', credentials=credentials)\r\n\r\nset_iam_policy_request = {} # construct your object here\r\nrequest = service.organizations().setIamPolicy(body=set_iam_policy_request, resource=\"example-resource\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudresourcemanager.organizations.setIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudresourcemanager.v1beta1\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.Cloudresourcemanager.v1beta1;\r\nusing Google.Apis.Cloudresourcemanager.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudresourcemanagerSample\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 cloudresourcemanagerService = new CloudresourcemanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var setIamPolicyRequest = new SetIamPolicyRequest();\r\n // Add your code to populate the setIamPolicyRequest object\r\n var call = cloudresourcemanagerService.Organizations.SetIamPolicy(setIamPolicyRequest, \"example-resource\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudresourcemanager.organizations.testIamPermissions.snippet.json b/cloudresourcemanager.organizations.testIamPermissions.snippet.json new file mode 100644 index 0000000..00c2636 --- /dev/null +++ b/cloudresourcemanager.organizations.testIamPermissions.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudresourcemanager","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudresourcemanager.organizations.testIamPermissions\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/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/cloudresourcemanager/v1beta1/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.cloudresourcemanager.Cloudresourcemanager;\r\nimport com.google.api.services.cloudresourcemanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudresourcemanagerSample {\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\tCloudresourcemanager cloudresourcemanagerService = new Cloudresourcemanager.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\tTestIamPermissionsRequest testIamPermissionsRequest = new TestIamPermissionsRequest();\r\n\t\t// Add your code to populate the testIamPermissionsRequest object\r\n\t\tCloudresourcemanager.Organizations.TestIamPermissions call = cloudresourcemanagerService.organizations().testIamPermissions(\"example-resource\", testIamPermissionsRequest);\r\n\t\tTestIamPermissionsResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudresourcemanager.organizations.testIamPermissions\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudresourcemanager/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 'cloudresourcemanager' service, at version 'v1beta1'.\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('cloudresourcemanager', 'v1beta1', credentials=credentials)\r\n\r\ntest_iam_permissions_request = {} # construct your object here\r\nrequest = service.organizations().testIamPermissions(body=test_iam_permissions_request, resource=\"example-resource\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudresourcemanager.organizations.testIamPermissions\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudresourcemanager.v1beta1\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.Cloudresourcemanager.v1beta1;\r\nusing Google.Apis.Cloudresourcemanager.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudresourcemanagerSample\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 cloudresourcemanagerService = new CloudresourcemanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var testIamPermissionsRequest = new TestIamPermissionsRequest();\r\n // Add your code to populate the testIamPermissionsRequest object\r\n var call = cloudresourcemanagerService.Organizations.TestIamPermissions(testIamPermissionsRequest, \"example-resource\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudresourcemanager.organizations.update.snippet.json b/cloudresourcemanager.organizations.update.snippet.json new file mode 100644 index 0000000..af3089d --- /dev/null +++ b/cloudresourcemanager.organizations.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudresourcemanager","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudresourcemanager.organizations.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/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/cloudresourcemanager/v1beta1/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.cloudresourcemanager.Cloudresourcemanager;\r\nimport com.google.api.services.cloudresourcemanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudresourcemanagerSample {\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\tCloudresourcemanager cloudresourcemanagerService = new Cloudresourcemanager.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\tOrganization organization = new Organization();\r\n\t\t// Add your code to populate the organization object\r\n\t\tCloudresourcemanager.Organizations.Update call = cloudresourcemanagerService.organizations().update(\"example-organizationId\", organization);\r\n\t\tOrganization response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudresourcemanager.organizations.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudresourcemanager/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 'cloudresourcemanager' service, at version 'v1beta1'.\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('cloudresourcemanager', 'v1beta1', credentials=credentials)\r\n\r\norganization = {} # construct your object here\r\nrequest = service.organizations().update(body=organization, organizationId=\"example-organizationId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudresourcemanager.organizations.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudresourcemanager.v1beta1\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.Cloudresourcemanager.v1beta1;\r\nusing Google.Apis.Cloudresourcemanager.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudresourcemanagerSample\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 cloudresourcemanagerService = new CloudresourcemanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var organization = new Organization();\r\n // Add your code to populate the organization object\r\n var call = cloudresourcemanagerService.Organizations.Update(organization, \"example-organizationId\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudresourcemanager.projects.create.snippet.json b/cloudresourcemanager.projects.create.snippet.json new file mode 100644 index 0000000..fc7fcf8 --- /dev/null +++ b/cloudresourcemanager.projects.create.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudresourcemanager","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudresourcemanager.projects.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/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/cloudresourcemanager/v1beta1/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.cloudresourcemanager.Cloudresourcemanager;\r\nimport com.google.api.services.cloudresourcemanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudresourcemanagerSample {\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\tCloudresourcemanager cloudresourcemanagerService = new Cloudresourcemanager.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\tProject project = new Project();\r\n\t\t// Add your code to populate the project object\r\n\t\tCloudresourcemanager.Projects.Create call = cloudresourcemanagerService.projects().create(project);\r\n\t\tProject response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudresourcemanager.projects.create\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudresourcemanager/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 'cloudresourcemanager' service, at version 'v1beta1'.\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('cloudresourcemanager', 'v1beta1', credentials=credentials)\r\n\r\nproject = {} # construct your object here\r\nrequest = service.projects().create(body=project)\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudresourcemanager.projects.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudresourcemanager.v1beta1\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.Cloudresourcemanager.v1beta1;\r\nusing Google.Apis.Cloudresourcemanager.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudresourcemanagerSample\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 cloudresourcemanagerService = new CloudresourcemanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var project = new Project();\r\n // Add your code to populate the project object\r\n var call = cloudresourcemanagerService.Projects.Create(project);\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudresourcemanager.projects.delete.snippet.json b/cloudresourcemanager.projects.delete.snippet.json new file mode 100644 index 0000000..401868e --- /dev/null +++ b/cloudresourcemanager.projects.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudresourcemanager","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudresourcemanager.projects.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/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/cloudresourcemanager/v1beta1/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.cloudresourcemanager.Cloudresourcemanager;\r\nimport com.google.api.services.cloudresourcemanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudresourcemanagerSample {\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\tCloudresourcemanager cloudresourcemanagerService = new Cloudresourcemanager.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\tCloudresourcemanager.Projects.Delete request = cloudresourcemanagerService.projects().delete(\"example-project\");\r\n\t\tEmpty response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudresourcemanager.projects.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudresourcemanager/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 'cloudresourcemanager' service, at version 'v1beta1'.\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('cloudresourcemanager', 'v1beta1', credentials=credentials)\r\n\r\nservice.projects().delete(projectId=\"example-project\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudresourcemanager.projects.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudresourcemanager.v1beta1\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.Cloudresourcemanager.v1beta1;\r\nusing Google.Apis.Cloudresourcemanager.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudresourcemanagerSample\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 cloudresourcemanagerService = new CloudresourcemanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = cloudresourcemanagerService.Projects.Delete(\"example-project\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudresourcemanager.projects.get.snippet.json b/cloudresourcemanager.projects.get.snippet.json new file mode 100644 index 0000000..dcf3cfe --- /dev/null +++ b/cloudresourcemanager.projects.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudresourcemanager","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudresourcemanager.projects.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/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/cloudresourcemanager/v1beta1/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.cloudresourcemanager.Cloudresourcemanager;\r\nimport com.google.api.services.cloudresourcemanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudresourcemanagerSample {\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\tCloudresourcemanager cloudresourcemanagerService = new Cloudresourcemanager.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\tCloudresourcemanager.Projects.Get request = cloudresourcemanagerService.projects().get(\"example-project\");\r\n\t\tProject response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudresourcemanager.projects.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudresourcemanager/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 'cloudresourcemanager' service, at version 'v1beta1'.\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('cloudresourcemanager', 'v1beta1', credentials=credentials)\r\n\r\nservice.projects().get(projectId=\"example-project\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudresourcemanager.projects.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudresourcemanager.v1beta1\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.Cloudresourcemanager.v1beta1;\r\nusing Google.Apis.Cloudresourcemanager.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudresourcemanagerSample\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 cloudresourcemanagerService = new CloudresourcemanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = cloudresourcemanagerService.Projects.Get(\"example-project\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudresourcemanager.projects.getIamPolicy.snippet.json b/cloudresourcemanager.projects.getIamPolicy.snippet.json new file mode 100644 index 0000000..46340f9 --- /dev/null +++ b/cloudresourcemanager.projects.getIamPolicy.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudresourcemanager","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudresourcemanager.projects.getIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/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/cloudresourcemanager/v1beta1/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.cloudresourcemanager.Cloudresourcemanager;\r\nimport com.google.api.services.cloudresourcemanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudresourcemanagerSample {\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\tCloudresourcemanager cloudresourcemanagerService = new Cloudresourcemanager.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\tGetIamPolicyRequest getIamPolicyRequest = new GetIamPolicyRequest();\r\n\t\t// Add your code to populate the getIamPolicyRequest object\r\n\t\tCloudresourcemanager.Projects.GetIamPolicy call = cloudresourcemanagerService.projects().getIamPolicy(\"example-resource\", getIamPolicyRequest);\r\n\t\tPolicy response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudresourcemanager.projects.getIamPolicy\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudresourcemanager/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 'cloudresourcemanager' service, at version 'v1beta1'.\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('cloudresourcemanager', 'v1beta1', credentials=credentials)\r\n\r\nget_iam_policy_request = {} # construct your object here\r\nrequest = service.projects().getIamPolicy(body=get_iam_policy_request, resource=\"example-resource\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudresourcemanager.projects.getIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudresourcemanager.v1beta1\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.Cloudresourcemanager.v1beta1;\r\nusing Google.Apis.Cloudresourcemanager.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudresourcemanagerSample\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 cloudresourcemanagerService = new CloudresourcemanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var getIamPolicyRequest = new GetIamPolicyRequest();\r\n // Add your code to populate the getIamPolicyRequest object\r\n var call = cloudresourcemanagerService.Projects.GetIamPolicy(getIamPolicyRequest, \"example-resource\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudresourcemanager.projects.list.snippet.json b/cloudresourcemanager.projects.list.snippet.json new file mode 100644 index 0000000..749205e --- /dev/null +++ b/cloudresourcemanager.projects.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudresourcemanager","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudresourcemanager.projects.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/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/cloudresourcemanager/v1beta1/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.cloudresourcemanager.Cloudresourcemanager;\r\nimport com.google.api.services.cloudresourcemanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudresourcemanagerSample {\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\tCloudresourcemanager cloudresourcemanagerService = new Cloudresourcemanager.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\tListProjectsResponse response;\r\n\t\tCloudresourcemanager.Projects.List request = cloudresourcemanagerService.projects().list();\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getProjects() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Project item : response.getProjects()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for cloudresourcemanager.projects.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudresourcemanager/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 'cloudresourcemanager' service, at version 'v1beta1'.\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('cloudresourcemanager', 'v1beta1', credentials=credentials)\r\n\r\nrequest = service.projects().list()\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.projects().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudresourcemanager.projects.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudresourcemanager.v1beta1\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.Cloudresourcemanager.v1beta1;\r\nusing Google.Apis.Cloudresourcemanager.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudresourcemanagerSample\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 cloudresourcemanagerService = new CloudresourcemanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListProjectsResponse response;\r\n var request = cloudresourcemanagerService.Projects.List();\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Projects == null)\r\n continue;\r\n\r\n foreach (var item in response.Projects)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudresourcemanager.projects.setIamPolicy.snippet.json b/cloudresourcemanager.projects.setIamPolicy.snippet.json new file mode 100644 index 0000000..f76f99e --- /dev/null +++ b/cloudresourcemanager.projects.setIamPolicy.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudresourcemanager","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudresourcemanager.projects.setIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/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/cloudresourcemanager/v1beta1/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.cloudresourcemanager.Cloudresourcemanager;\r\nimport com.google.api.services.cloudresourcemanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudresourcemanagerSample {\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\tCloudresourcemanager cloudresourcemanagerService = new Cloudresourcemanager.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\tSetIamPolicyRequest setIamPolicyRequest = new SetIamPolicyRequest();\r\n\t\t// Add your code to populate the setIamPolicyRequest object\r\n\t\tCloudresourcemanager.Projects.SetIamPolicy call = cloudresourcemanagerService.projects().setIamPolicy(\"example-resource\", setIamPolicyRequest);\r\n\t\tPolicy response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudresourcemanager.projects.setIamPolicy\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudresourcemanager/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 'cloudresourcemanager' service, at version 'v1beta1'.\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('cloudresourcemanager', 'v1beta1', credentials=credentials)\r\n\r\nset_iam_policy_request = {} # construct your object here\r\nrequest = service.projects().setIamPolicy(body=set_iam_policy_request, resource=\"example-resource\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudresourcemanager.projects.setIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudresourcemanager.v1beta1\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.Cloudresourcemanager.v1beta1;\r\nusing Google.Apis.Cloudresourcemanager.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudresourcemanagerSample\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 cloudresourcemanagerService = new CloudresourcemanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var setIamPolicyRequest = new SetIamPolicyRequest();\r\n // Add your code to populate the setIamPolicyRequest object\r\n var call = cloudresourcemanagerService.Projects.SetIamPolicy(setIamPolicyRequest, \"example-resource\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudresourcemanager.projects.testIamPermissions.snippet.json b/cloudresourcemanager.projects.testIamPermissions.snippet.json new file mode 100644 index 0000000..87824a6 --- /dev/null +++ b/cloudresourcemanager.projects.testIamPermissions.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudresourcemanager","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudresourcemanager.projects.testIamPermissions\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/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/cloudresourcemanager/v1beta1/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.cloudresourcemanager.Cloudresourcemanager;\r\nimport com.google.api.services.cloudresourcemanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudresourcemanagerSample {\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\tCloudresourcemanager cloudresourcemanagerService = new Cloudresourcemanager.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\tTestIamPermissionsRequest testIamPermissionsRequest = new TestIamPermissionsRequest();\r\n\t\t// Add your code to populate the testIamPermissionsRequest object\r\n\t\tCloudresourcemanager.Projects.TestIamPermissions call = cloudresourcemanagerService.projects().testIamPermissions(\"example-resource\", testIamPermissionsRequest);\r\n\t\tTestIamPermissionsResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudresourcemanager.projects.testIamPermissions\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudresourcemanager/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 'cloudresourcemanager' service, at version 'v1beta1'.\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('cloudresourcemanager', 'v1beta1', credentials=credentials)\r\n\r\ntest_iam_permissions_request = {} # construct your object here\r\nrequest = service.projects().testIamPermissions(body=test_iam_permissions_request, resource=\"example-resource\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudresourcemanager.projects.testIamPermissions\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudresourcemanager.v1beta1\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.Cloudresourcemanager.v1beta1;\r\nusing Google.Apis.Cloudresourcemanager.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudresourcemanagerSample\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 cloudresourcemanagerService = new CloudresourcemanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var testIamPermissionsRequest = new TestIamPermissionsRequest();\r\n // Add your code to populate the testIamPermissionsRequest object\r\n var call = cloudresourcemanagerService.Projects.TestIamPermissions(testIamPermissionsRequest, \"example-resource\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudresourcemanager.projects.undelete.snippet.json b/cloudresourcemanager.projects.undelete.snippet.json new file mode 100644 index 0000000..6558014 --- /dev/null +++ b/cloudresourcemanager.projects.undelete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudresourcemanager","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudresourcemanager.projects.undelete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/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/cloudresourcemanager/v1beta1/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.cloudresourcemanager.Cloudresourcemanager;\r\nimport com.google.api.services.cloudresourcemanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudresourcemanagerSample {\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\tCloudresourcemanager cloudresourcemanagerService = new Cloudresourcemanager.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\tCloudresourcemanager.Projects.Undelete request = cloudresourcemanagerService.projects().undelete(\"example-project\");\r\n\t\tEmpty response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudresourcemanager.projects.undelete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudresourcemanager/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 'cloudresourcemanager' service, at version 'v1beta1'.\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('cloudresourcemanager', 'v1beta1', credentials=credentials)\r\n\r\nservice.projects().undelete(projectId=\"example-project\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudresourcemanager.projects.undelete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudresourcemanager.v1beta1\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.Cloudresourcemanager.v1beta1;\r\nusing Google.Apis.Cloudresourcemanager.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudresourcemanagerSample\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 cloudresourcemanagerService = new CloudresourcemanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = cloudresourcemanagerService.Projects.Undelete(\"example-project\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudresourcemanager.projects.update.snippet.json b/cloudresourcemanager.projects.update.snippet.json new file mode 100644 index 0000000..1bdfa12 --- /dev/null +++ b/cloudresourcemanager.projects.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudresourcemanager","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudresourcemanager.projects.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/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/cloudresourcemanager/v1beta1/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.cloudresourcemanager.Cloudresourcemanager;\r\nimport com.google.api.services.cloudresourcemanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudresourcemanagerSample {\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\tCloudresourcemanager cloudresourcemanagerService = new Cloudresourcemanager.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\tProject project = new Project();\r\n\t\t// Add your code to populate the project object\r\n\t\tCloudresourcemanager.Projects.Update call = cloudresourcemanagerService.projects().update(\"example-project\", project);\r\n\t\tProject response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudresourcemanager.projects.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudresourcemanager/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 'cloudresourcemanager' service, at version 'v1beta1'.\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('cloudresourcemanager', 'v1beta1', credentials=credentials)\r\n\r\nproject = {} # construct your object here\r\nrequest = service.projects().update(body=project, projectId=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudresourcemanager.projects.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudresourcemanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudresourcemanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudresourcemanager.v1beta1\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.Cloudresourcemanager.v1beta1;\r\nusing Google.Apis.Cloudresourcemanager.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudresourcemanagerSample\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 cloudresourcemanagerService = new CloudresourcemanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var project = new Project();\r\n // Add your code to populate the project object\r\n var call = cloudresourcemanagerService.Projects.Update(project, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudtrace.projects.patchTraces.snippet.json b/cloudtrace.projects.patchTraces.snippet.json new file mode 100644 index 0000000..2c78148 --- /dev/null +++ b/cloudtrace.projects.patchTraces.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudtrace","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudtrace.projects.patchTraces\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudtrace Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudtrace/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/cloudtrace/v1/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.cloudtrace.Cloudtrace;\r\nimport com.google.api.services.cloudtrace.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudtraceSample {\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\tCloudtrace cloudtraceService = new Cloudtrace.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\t// Obtain the Traces object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the PatchTraces method\r\n\t\tCloudtrace.Projects.PatchTraces request = cloudtraceService.projects().patchTraces(\"example-project\", traces);\r\n\t\tEmpty response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudtrace.projects.patchTraces\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudtrace Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudtrace/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 'cloudtrace' service, at version 'v1'.\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('cloudtrace', 'v1', credentials=credentials)\r\n\r\n# Obtain the traces object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patchTraces method\r\nrequest = service.projects().patchTraces(body=traces, projectId=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudtrace.projects.patchTraces\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudtrace Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudtrace/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudtrace.v1\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.Cloudtrace.v1;\r\nusing Google.Apis.Cloudtrace.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudtraceSample\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 cloudtraceService = new CloudtraceService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the Traces object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the PatchTraces method\r\n var request = cloudtraceService.Projects.PatchTraces(traces, \"example-project\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudtrace.projects.traces.get.snippet.json b/cloudtrace.projects.traces.get.snippet.json new file mode 100644 index 0000000..9d3aed7 --- /dev/null +++ b/cloudtrace.projects.traces.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudtrace","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudtrace.projects.traces.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudtrace Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudtrace/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/cloudtrace/v1/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.cloudtrace.Cloudtrace;\r\nimport com.google.api.services.cloudtrace.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudtraceSample {\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\tCloudtrace cloudtraceService = new Cloudtrace.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\tCloudtrace.Projects.Traces.Get request = cloudtraceService.projects().traces().get(\"example-project\", \"example-traceId\");\r\n\t\tTrace response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for cloudtrace.projects.traces.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudtrace Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudtrace/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 'cloudtrace' service, at version 'v1'.\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('cloudtrace', 'v1', credentials=credentials)\r\n\r\nservice.projects().traces().get(projectId=\"example-project\", traceId=\"example-traceId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudtrace.projects.traces.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudtrace Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudtrace/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudtrace.v1\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.Cloudtrace.v1;\r\nusing Google.Apis.Cloudtrace.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudtraceSample\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 cloudtraceService = new CloudtraceService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = cloudtraceService.Projects.Traces.Get(\"example-project\", \"example-traceId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/cloudtrace.projects.traces.list.snippet.json b/cloudtrace.projects.traces.list.snippet.json new file mode 100644 index 0000000..0519b70 --- /dev/null +++ b/cloudtrace.projects.traces.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"cloudtrace","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for cloudtrace.projects.traces.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudtrace Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudtrace/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/cloudtrace/v1/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.cloudtrace.Cloudtrace;\r\nimport com.google.api.services.cloudtrace.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class CloudtraceSample {\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\tCloudtrace cloudtraceService = new Cloudtrace.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\tListTracesResponse response;\r\n\t\tCloudtrace.Projects.Traces.List request = cloudtraceService.projects().traces().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getTraces() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Trace item : response.getTraces()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for cloudtrace.projects.traces.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable cloudtrace Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/cloudtrace/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 'cloudtrace' service, at version 'v1'.\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('cloudtrace', 'v1', credentials=credentials)\r\n\r\nrequest = service.projects().traces().list(projectId=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.projects().traces().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for cloudtrace.projects.traces.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable cloudtrace Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/cloudtrace/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.cloudtrace.v1\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.Cloudtrace.v1;\r\nusing Google.Apis.Cloudtrace.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass CloudtraceSample\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 cloudtraceService = new CloudtraceService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListTracesResponse response;\r\n var request = cloudtraceService.Projects.Traces.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Traces == null)\r\n continue;\r\n\r\n foreach (var item in response.Traces)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouduseraccounts.globalAccountsOperations.delete.snippet.json b/clouduseraccounts.globalAccountsOperations.delete.snippet.json new file mode 100644 index 0000000..ec935c7 --- /dev/null +++ b/clouduseraccounts.globalAccountsOperations.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouduseraccounts","apiVersion":"vm_beta","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouduseraccounts.globalAccountsOperations.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/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/clouduseraccounts/vm_beta/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.clouduseraccounts.Clouduseraccounts;\r\nimport com.google.api.services.clouduseraccounts.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouduseraccountsSample {\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\tClouduseraccounts clouduseraccountsService = new Clouduseraccounts.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\tClouduseraccounts.GlobalAccountsOperations.Delete request = clouduseraccountsService.globalAccountsOperations().delete(\"example-project\", \"example-operation\");\r\n\t\t response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouduseraccounts.globalAccountsOperations.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouduseraccounts/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 'clouduseraccounts' service, at version 'vm_beta'.\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('clouduseraccounts', 'vm_beta', credentials=credentials)\r\n\r\nservice.globalAccountsOperations().delete(project=\"example-project\", operation=\"example-operation\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouduseraccounts.globalAccountsOperations.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouduseraccounts.vm_beta\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.Clouduseraccounts.vm_beta;\r\nusing Google.Apis.Clouduseraccounts.vm_beta.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouduseraccountsSample\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 clouduseraccountsService = new ClouduseraccountsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = clouduseraccountsService.GlobalAccountsOperations.Delete(\"example-project\", \"example-operation\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouduseraccounts.globalAccountsOperations.get.snippet.json b/clouduseraccounts.globalAccountsOperations.get.snippet.json new file mode 100644 index 0000000..7f2404c --- /dev/null +++ b/clouduseraccounts.globalAccountsOperations.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouduseraccounts","apiVersion":"vm_beta","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouduseraccounts.globalAccountsOperations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/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/clouduseraccounts/vm_beta/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.clouduseraccounts.Clouduseraccounts;\r\nimport com.google.api.services.clouduseraccounts.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouduseraccountsSample {\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\tClouduseraccounts clouduseraccountsService = new Clouduseraccounts.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\tClouduseraccounts.GlobalAccountsOperations.Get request = clouduseraccountsService.globalAccountsOperations().get(\"example-project\", \"example-operation\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouduseraccounts.globalAccountsOperations.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouduseraccounts/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 'clouduseraccounts' service, at version 'vm_beta'.\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('clouduseraccounts', 'vm_beta', credentials=credentials)\r\n\r\nservice.globalAccountsOperations().get(project=\"example-project\", operation=\"example-operation\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouduseraccounts.globalAccountsOperations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouduseraccounts.vm_beta\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.Clouduseraccounts.vm_beta;\r\nusing Google.Apis.Clouduseraccounts.vm_beta.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouduseraccountsSample\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 clouduseraccountsService = new ClouduseraccountsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = clouduseraccountsService.GlobalAccountsOperations.Get(\"example-project\", \"example-operation\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouduseraccounts.globalAccountsOperations.list.snippet.json b/clouduseraccounts.globalAccountsOperations.list.snippet.json new file mode 100644 index 0000000..798d678 --- /dev/null +++ b/clouduseraccounts.globalAccountsOperations.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouduseraccounts","apiVersion":"vm_beta","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouduseraccounts.globalAccountsOperations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/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/clouduseraccounts/vm_beta/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.clouduseraccounts.Clouduseraccounts;\r\nimport com.google.api.services.clouduseraccounts.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouduseraccountsSample {\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\tClouduseraccounts clouduseraccountsService = new Clouduseraccounts.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\tOperationList response;\r\n\t\tClouduseraccounts.GlobalAccountsOperations.List request = clouduseraccountsService.globalAccountsOperations().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Operation item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for clouduseraccounts.globalAccountsOperations.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouduseraccounts/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 'clouduseraccounts' service, at version 'vm_beta'.\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('clouduseraccounts', 'vm_beta', credentials=credentials)\r\n\r\nrequest = service.globalAccountsOperations().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.globalAccountsOperations().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouduseraccounts.globalAccountsOperations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouduseraccounts.vm_beta\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.Clouduseraccounts.vm_beta;\r\nusing Google.Apis.Clouduseraccounts.vm_beta.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouduseraccountsSample\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 clouduseraccountsService = new ClouduseraccountsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n OperationList response;\r\n var request = clouduseraccountsService.GlobalAccountsOperations.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouduseraccounts.groups.addMember.snippet.json b/clouduseraccounts.groups.addMember.snippet.json new file mode 100644 index 0000000..3a89508 --- /dev/null +++ b/clouduseraccounts.groups.addMember.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouduseraccounts","apiVersion":"vm_beta","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouduseraccounts.groups.addMember\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/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/clouduseraccounts/vm_beta/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.clouduseraccounts.Clouduseraccounts;\r\nimport com.google.api.services.clouduseraccounts.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouduseraccountsSample {\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\tClouduseraccounts clouduseraccountsService = new Clouduseraccounts.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\tGroupsAddMemberRequest groupsAddMemberRequest = new GroupsAddMemberRequest();\r\n\t\t// Add your code to populate the groupsAddMemberRequest object\r\n\t\tClouduseraccounts.Groups.AddMember call = clouduseraccountsService.groups().addMember(\"example-project\", \"example-groupName\", groupsAddMemberRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouduseraccounts.groups.addMember\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouduseraccounts/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 'clouduseraccounts' service, at version 'vm_beta'.\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('clouduseraccounts', 'vm_beta', credentials=credentials)\r\n\r\ngroups_add_member_request = {} # construct your object here\r\nrequest = service.groups().addMember(body=groups_add_member_request, project=\"example-project\", groupName=\"example-groupName\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouduseraccounts.groups.addMember\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouduseraccounts.vm_beta\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.Clouduseraccounts.vm_beta;\r\nusing Google.Apis.Clouduseraccounts.vm_beta.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouduseraccountsSample\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 clouduseraccountsService = new ClouduseraccountsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var groupsAddMemberRequest = new GroupsAddMemberRequest();\r\n // Add your code to populate the groupsAddMemberRequest object\r\n var call = clouduseraccountsService.Groups.AddMember(groupsAddMemberRequest, \"example-project\", \"example-groupName\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouduseraccounts.groups.delete.snippet.json b/clouduseraccounts.groups.delete.snippet.json new file mode 100644 index 0000000..97cf03d --- /dev/null +++ b/clouduseraccounts.groups.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouduseraccounts","apiVersion":"vm_beta","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouduseraccounts.groups.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/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/clouduseraccounts/vm_beta/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.clouduseraccounts.Clouduseraccounts;\r\nimport com.google.api.services.clouduseraccounts.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouduseraccountsSample {\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\tClouduseraccounts clouduseraccountsService = new Clouduseraccounts.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\tClouduseraccounts.Groups.Delete request = clouduseraccountsService.groups().delete(\"example-project\", \"example-groupName\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouduseraccounts.groups.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouduseraccounts/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 'clouduseraccounts' service, at version 'vm_beta'.\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('clouduseraccounts', 'vm_beta', credentials=credentials)\r\n\r\nservice.groups().delete(project=\"example-project\", groupName=\"example-groupName\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouduseraccounts.groups.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouduseraccounts.vm_beta\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.Clouduseraccounts.vm_beta;\r\nusing Google.Apis.Clouduseraccounts.vm_beta.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouduseraccountsSample\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 clouduseraccountsService = new ClouduseraccountsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = clouduseraccountsService.Groups.Delete(\"example-project\", \"example-groupName\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouduseraccounts.groups.get.snippet.json b/clouduseraccounts.groups.get.snippet.json new file mode 100644 index 0000000..c0e8239 --- /dev/null +++ b/clouduseraccounts.groups.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouduseraccounts","apiVersion":"vm_beta","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouduseraccounts.groups.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/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/clouduseraccounts/vm_beta/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.clouduseraccounts.Clouduseraccounts;\r\nimport com.google.api.services.clouduseraccounts.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouduseraccountsSample {\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\tClouduseraccounts clouduseraccountsService = new Clouduseraccounts.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\tClouduseraccounts.Groups.Get request = clouduseraccountsService.groups().get(\"example-project\", \"example-groupName\");\r\n\t\tGroup response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouduseraccounts.groups.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouduseraccounts/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 'clouduseraccounts' service, at version 'vm_beta'.\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('clouduseraccounts', 'vm_beta', credentials=credentials)\r\n\r\nservice.groups().get(project=\"example-project\", groupName=\"example-groupName\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouduseraccounts.groups.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouduseraccounts.vm_beta\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.Clouduseraccounts.vm_beta;\r\nusing Google.Apis.Clouduseraccounts.vm_beta.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouduseraccountsSample\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 clouduseraccountsService = new ClouduseraccountsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = clouduseraccountsService.Groups.Get(\"example-project\", \"example-groupName\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouduseraccounts.groups.insert.snippet.json b/clouduseraccounts.groups.insert.snippet.json new file mode 100644 index 0000000..e2484e6 --- /dev/null +++ b/clouduseraccounts.groups.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouduseraccounts","apiVersion":"vm_beta","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouduseraccounts.groups.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/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/clouduseraccounts/vm_beta/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.clouduseraccounts.Clouduseraccounts;\r\nimport com.google.api.services.clouduseraccounts.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouduseraccountsSample {\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\tClouduseraccounts clouduseraccountsService = new Clouduseraccounts.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\tGroup group = new Group();\r\n\t\t// Add your code to populate the group object\r\n\t\tClouduseraccounts.Groups.Insert call = clouduseraccountsService.groups().insert(\"example-project\", group);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouduseraccounts.groups.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouduseraccounts/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 'clouduseraccounts' service, at version 'vm_beta'.\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('clouduseraccounts', 'vm_beta', credentials=credentials)\r\n\r\ngroup = {} # construct your object here\r\nrequest = service.groups().insert(body=group, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouduseraccounts.groups.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouduseraccounts.vm_beta\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.Clouduseraccounts.vm_beta;\r\nusing Google.Apis.Clouduseraccounts.vm_beta.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouduseraccountsSample\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 clouduseraccountsService = new ClouduseraccountsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var group = new Group();\r\n // Add your code to populate the group object\r\n var call = clouduseraccountsService.Groups.Insert(group, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouduseraccounts.groups.list.snippet.json b/clouduseraccounts.groups.list.snippet.json new file mode 100644 index 0000000..473d391 --- /dev/null +++ b/clouduseraccounts.groups.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouduseraccounts","apiVersion":"vm_beta","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouduseraccounts.groups.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/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/clouduseraccounts/vm_beta/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.clouduseraccounts.Clouduseraccounts;\r\nimport com.google.api.services.clouduseraccounts.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouduseraccountsSample {\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\tClouduseraccounts clouduseraccountsService = new Clouduseraccounts.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\tGroupList response;\r\n\t\tClouduseraccounts.Groups.List request = clouduseraccountsService.groups().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Group item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for clouduseraccounts.groups.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouduseraccounts/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 'clouduseraccounts' service, at version 'vm_beta'.\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('clouduseraccounts', 'vm_beta', credentials=credentials)\r\n\r\nrequest = service.groups().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.groups().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouduseraccounts.groups.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouduseraccounts.vm_beta\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.Clouduseraccounts.vm_beta;\r\nusing Google.Apis.Clouduseraccounts.vm_beta.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouduseraccountsSample\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 clouduseraccountsService = new ClouduseraccountsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n GroupList response;\r\n var request = clouduseraccountsService.Groups.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouduseraccounts.groups.removeMember.snippet.json b/clouduseraccounts.groups.removeMember.snippet.json new file mode 100644 index 0000000..585b453 --- /dev/null +++ b/clouduseraccounts.groups.removeMember.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouduseraccounts","apiVersion":"vm_beta","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouduseraccounts.groups.removeMember\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/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/clouduseraccounts/vm_beta/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.clouduseraccounts.Clouduseraccounts;\r\nimport com.google.api.services.clouduseraccounts.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouduseraccountsSample {\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\tClouduseraccounts clouduseraccountsService = new Clouduseraccounts.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\tGroupsRemoveMemberRequest groupsRemoveMemberRequest = new GroupsRemoveMemberRequest();\r\n\t\t// Add your code to populate the groupsRemoveMemberRequest object\r\n\t\tClouduseraccounts.Groups.RemoveMember call = clouduseraccountsService.groups().removeMember(\"example-project\", \"example-groupName\", groupsRemoveMemberRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouduseraccounts.groups.removeMember\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouduseraccounts/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 'clouduseraccounts' service, at version 'vm_beta'.\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('clouduseraccounts', 'vm_beta', credentials=credentials)\r\n\r\ngroups_remove_member_request = {} # construct your object here\r\nrequest = service.groups().removeMember(body=groups_remove_member_request, project=\"example-project\", groupName=\"example-groupName\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouduseraccounts.groups.removeMember\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouduseraccounts.vm_beta\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.Clouduseraccounts.vm_beta;\r\nusing Google.Apis.Clouduseraccounts.vm_beta.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouduseraccountsSample\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 clouduseraccountsService = new ClouduseraccountsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var groupsRemoveMemberRequest = new GroupsRemoveMemberRequest();\r\n // Add your code to populate the groupsRemoveMemberRequest object\r\n var call = clouduseraccountsService.Groups.RemoveMember(groupsRemoveMemberRequest, \"example-project\", \"example-groupName\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouduseraccounts.linux.getAuthorizedKeysView.snippet.json b/clouduseraccounts.linux.getAuthorizedKeysView.snippet.json new file mode 100644 index 0000000..8fc8a14 --- /dev/null +++ b/clouduseraccounts.linux.getAuthorizedKeysView.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouduseraccounts","apiVersion":"vm_beta","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouduseraccounts.linux.getAuthorizedKeysView\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/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/clouduseraccounts/vm_beta/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.clouduseraccounts.Clouduseraccounts;\r\nimport com.google.api.services.clouduseraccounts.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouduseraccountsSample {\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\tClouduseraccounts clouduseraccountsService = new Clouduseraccounts.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\tClouduseraccounts.Linux.GetAuthorizedKeysView request = clouduseraccountsService.linux().getAuthorizedKeysView(\"example-project\", \"us-central1-a\", \"example-user\", \"debian-instance-1\");\r\n\t\tLinuxGetAuthorizedKeysViewResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouduseraccounts.linux.getAuthorizedKeysView\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouduseraccounts/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 'clouduseraccounts' service, at version 'vm_beta'.\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('clouduseraccounts', 'vm_beta', credentials=credentials)\r\n\r\nservice.linux().getAuthorizedKeysView(project=\"example-project\", zone=\"us-central1-a\", user=\"example-user\", instance=\"debian-instance-1\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouduseraccounts.linux.getAuthorizedKeysView\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouduseraccounts.vm_beta\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.Clouduseraccounts.vm_beta;\r\nusing Google.Apis.Clouduseraccounts.vm_beta.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouduseraccountsSample\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 clouduseraccountsService = new ClouduseraccountsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = clouduseraccountsService.Linux.GetAuthorizedKeysView(\"example-project\", \"us-central1-a\", \"example-user\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouduseraccounts.linux.getLinuxAccountViews.snippet.json b/clouduseraccounts.linux.getLinuxAccountViews.snippet.json new file mode 100644 index 0000000..5857b6f --- /dev/null +++ b/clouduseraccounts.linux.getLinuxAccountViews.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouduseraccounts","apiVersion":"vm_beta","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouduseraccounts.linux.getLinuxAccountViews\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/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/clouduseraccounts/vm_beta/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.clouduseraccounts.Clouduseraccounts;\r\nimport com.google.api.services.clouduseraccounts.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouduseraccountsSample {\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\tClouduseraccounts clouduseraccountsService = new Clouduseraccounts.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\tClouduseraccounts.Linux.GetLinuxAccountViews request = clouduseraccountsService.linux().getLinuxAccountViews(\"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n\t\tLinuxGetLinuxAccountViewsResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouduseraccounts.linux.getLinuxAccountViews\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouduseraccounts/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 'clouduseraccounts' service, at version 'vm_beta'.\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('clouduseraccounts', 'vm_beta', credentials=credentials)\r\n\r\nservice.linux().getLinuxAccountViews(project=\"example-project\", zone=\"us-central1-a\", instance=\"debian-instance-1\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouduseraccounts.linux.getLinuxAccountViews\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouduseraccounts.vm_beta\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.Clouduseraccounts.vm_beta;\r\nusing Google.Apis.Clouduseraccounts.vm_beta.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouduseraccountsSample\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 clouduseraccountsService = new ClouduseraccountsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = clouduseraccountsService.Linux.GetLinuxAccountViews(\"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouduseraccounts.users.addPublicKey.snippet.json b/clouduseraccounts.users.addPublicKey.snippet.json new file mode 100644 index 0000000..5ca32eb --- /dev/null +++ b/clouduseraccounts.users.addPublicKey.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouduseraccounts","apiVersion":"vm_beta","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouduseraccounts.users.addPublicKey\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/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/clouduseraccounts/vm_beta/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.clouduseraccounts.Clouduseraccounts;\r\nimport com.google.api.services.clouduseraccounts.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouduseraccountsSample {\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\tClouduseraccounts clouduseraccountsService = new Clouduseraccounts.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\tPublicKey publicKey = new PublicKey();\r\n\t\t// Add your code to populate the publicKey object\r\n\t\tClouduseraccounts.Users.AddPublicKey call = clouduseraccountsService.users().addPublicKey(\"example-project\", \"example-user\", publicKey);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouduseraccounts.users.addPublicKey\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouduseraccounts/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 'clouduseraccounts' service, at version 'vm_beta'.\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('clouduseraccounts', 'vm_beta', credentials=credentials)\r\n\r\npublic_key = {} # construct your object here\r\nrequest = service.users().addPublicKey(body=public_key, project=\"example-project\", user=\"example-user\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouduseraccounts.users.addPublicKey\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouduseraccounts.vm_beta\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.Clouduseraccounts.vm_beta;\r\nusing Google.Apis.Clouduseraccounts.vm_beta.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouduseraccountsSample\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 clouduseraccountsService = new ClouduseraccountsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var publicKey = new PublicKey();\r\n // Add your code to populate the publicKey object\r\n var call = clouduseraccountsService.Users.AddPublicKey(publicKey, \"example-project\", \"example-user\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouduseraccounts.users.delete.snippet.json b/clouduseraccounts.users.delete.snippet.json new file mode 100644 index 0000000..ce07ebc --- /dev/null +++ b/clouduseraccounts.users.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouduseraccounts","apiVersion":"vm_beta","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouduseraccounts.users.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/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/clouduseraccounts/vm_beta/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.clouduseraccounts.Clouduseraccounts;\r\nimport com.google.api.services.clouduseraccounts.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouduseraccountsSample {\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\tClouduseraccounts clouduseraccountsService = new Clouduseraccounts.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\tClouduseraccounts.Users.Delete request = clouduseraccountsService.users().delete(\"example-project\", \"example-user\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouduseraccounts.users.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouduseraccounts/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 'clouduseraccounts' service, at version 'vm_beta'.\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('clouduseraccounts', 'vm_beta', credentials=credentials)\r\n\r\nservice.users().delete(project=\"example-project\", user=\"example-user\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouduseraccounts.users.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouduseraccounts.vm_beta\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.Clouduseraccounts.vm_beta;\r\nusing Google.Apis.Clouduseraccounts.vm_beta.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouduseraccountsSample\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 clouduseraccountsService = new ClouduseraccountsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = clouduseraccountsService.Users.Delete(\"example-project\", \"example-user\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouduseraccounts.users.get.snippet.json b/clouduseraccounts.users.get.snippet.json new file mode 100644 index 0000000..b844269 --- /dev/null +++ b/clouduseraccounts.users.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouduseraccounts","apiVersion":"vm_beta","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouduseraccounts.users.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/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/clouduseraccounts/vm_beta/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.clouduseraccounts.Clouduseraccounts;\r\nimport com.google.api.services.clouduseraccounts.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouduseraccountsSample {\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\tClouduseraccounts clouduseraccountsService = new Clouduseraccounts.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\tClouduseraccounts.Users.Get request = clouduseraccountsService.users().get(\"example-project\", \"example-user\");\r\n\t\tUser response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouduseraccounts.users.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouduseraccounts/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 'clouduseraccounts' service, at version 'vm_beta'.\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('clouduseraccounts', 'vm_beta', credentials=credentials)\r\n\r\nservice.users().get(project=\"example-project\", user=\"example-user\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouduseraccounts.users.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouduseraccounts.vm_beta\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.Clouduseraccounts.vm_beta;\r\nusing Google.Apis.Clouduseraccounts.vm_beta.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouduseraccountsSample\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 clouduseraccountsService = new ClouduseraccountsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = clouduseraccountsService.Users.Get(\"example-project\", \"example-user\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouduseraccounts.users.insert.snippet.json b/clouduseraccounts.users.insert.snippet.json new file mode 100644 index 0000000..8984f63 --- /dev/null +++ b/clouduseraccounts.users.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouduseraccounts","apiVersion":"vm_beta","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouduseraccounts.users.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/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/clouduseraccounts/vm_beta/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.clouduseraccounts.Clouduseraccounts;\r\nimport com.google.api.services.clouduseraccounts.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouduseraccountsSample {\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\tClouduseraccounts clouduseraccountsService = new Clouduseraccounts.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\tUser user = new User();\r\n\t\t// Add your code to populate the user object\r\n\t\tClouduseraccounts.Users.Insert call = clouduseraccountsService.users().insert(\"example-project\", user);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouduseraccounts.users.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouduseraccounts/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 'clouduseraccounts' service, at version 'vm_beta'.\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('clouduseraccounts', 'vm_beta', credentials=credentials)\r\n\r\nuser = {} # construct your object here\r\nrequest = service.users().insert(body=user, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouduseraccounts.users.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouduseraccounts.vm_beta\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.Clouduseraccounts.vm_beta;\r\nusing Google.Apis.Clouduseraccounts.vm_beta.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouduseraccountsSample\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 clouduseraccountsService = new ClouduseraccountsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var user = new User();\r\n // Add your code to populate the user object\r\n var call = clouduseraccountsService.Users.Insert(user, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouduseraccounts.users.list.snippet.json b/clouduseraccounts.users.list.snippet.json new file mode 100644 index 0000000..e42a34e --- /dev/null +++ b/clouduseraccounts.users.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouduseraccounts","apiVersion":"vm_beta","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouduseraccounts.users.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/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/clouduseraccounts/vm_beta/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.clouduseraccounts.Clouduseraccounts;\r\nimport com.google.api.services.clouduseraccounts.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouduseraccountsSample {\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\tClouduseraccounts clouduseraccountsService = new Clouduseraccounts.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\tUserList response;\r\n\t\tClouduseraccounts.Users.List request = clouduseraccountsService.users().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (User item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for clouduseraccounts.users.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouduseraccounts/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 'clouduseraccounts' service, at version 'vm_beta'.\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('clouduseraccounts', 'vm_beta', credentials=credentials)\r\n\r\nrequest = service.users().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.users().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouduseraccounts.users.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouduseraccounts.vm_beta\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.Clouduseraccounts.vm_beta;\r\nusing Google.Apis.Clouduseraccounts.vm_beta.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouduseraccountsSample\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 clouduseraccountsService = new ClouduseraccountsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n UserList response;\r\n var request = clouduseraccountsService.Users.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/clouduseraccounts.users.removePublicKey.snippet.json b/clouduseraccounts.users.removePublicKey.snippet.json new file mode 100644 index 0000000..bad6ddb --- /dev/null +++ b/clouduseraccounts.users.removePublicKey.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"clouduseraccounts","apiVersion":"vm_beta","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for clouduseraccounts.users.removePublicKey\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/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/clouduseraccounts/vm_beta/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.clouduseraccounts.Clouduseraccounts;\r\nimport com.google.api.services.clouduseraccounts.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ClouduseraccountsSample {\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\tClouduseraccounts clouduseraccountsService = new Clouduseraccounts.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\tClouduseraccounts.Users.RemovePublicKey request = clouduseraccountsService.users().removePublicKey(\"example-project\", \"example-user\", \"example-fingerprint\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for clouduseraccounts.users.removePublicKey\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/clouduseraccounts/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 'clouduseraccounts' service, at version 'vm_beta'.\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('clouduseraccounts', 'vm_beta', credentials=credentials)\r\n\r\nservice.users().removePublicKey(project=\"example-project\", user=\"example-user\", fingerprint=\"example-fingerprint\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for clouduseraccounts.users.removePublicKey\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable clouduseraccounts Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/clouduseraccounts/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.clouduseraccounts.vm_beta\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.Clouduseraccounts.vm_beta;\r\nusing Google.Apis.Clouduseraccounts.vm_beta.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ClouduseraccountsSample\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 clouduseraccountsService = new ClouduseraccountsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = clouduseraccountsService.Users.RemovePublicKey(\"example-project\", \"example-user\", \"example-fingerprint\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.addresses.aggregatedList.snippet.json b/compute.addresses.aggregatedList.snippet.json new file mode 100644 index 0000000..e986be4 --- /dev/null +++ b/compute.addresses.aggregatedList.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.addresses.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tAddressAggregatedList response;\r\n\t\tCompute.Addresses.AggregatedList request = computeService.addresses().aggregatedList(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems().values() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (AddressesScopedList item : response.getItems().values()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.addresses.aggregatedList\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.addresses().aggregatedList(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.addresses().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.addresses.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n AddressAggregatedList response;\r\n var request = computeService.Addresses.AggregatedList(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items.Values == null)\r\n continue;\r\n\r\n foreach (var item in response.Items.Values)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.addresses.delete.snippet.json b/compute.addresses.delete.snippet.json new file mode 100644 index 0000000..2dc3130 --- /dev/null +++ b/compute.addresses.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.addresses.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Addresses.Delete request = computeService.addresses().delete(\"example-project\", \"example-region\", \"example-address\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.addresses.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.addresses().delete(project=\"example-project\", region=\"example-region\", address=\"example-address\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.addresses.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Addresses.Delete(\"example-project\", \"example-region\", \"example-address\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.addresses.get.snippet.json b/compute.addresses.get.snippet.json new file mode 100644 index 0000000..7a12fd9 --- /dev/null +++ b/compute.addresses.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.addresses.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Addresses.Get request = computeService.addresses().get(\"example-project\", \"example-region\", \"example-address\");\r\n\t\tAddress response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.addresses.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.addresses().get(project=\"example-project\", region=\"example-region\", address=\"example-address\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.addresses.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Addresses.Get(\"example-project\", \"example-region\", \"example-address\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.addresses.insert.snippet.json b/compute.addresses.insert.snippet.json new file mode 100644 index 0000000..95ac4bc --- /dev/null +++ b/compute.addresses.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.addresses.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tAddress address = new Address();\r\n\t\t// Add your code to populate the address object\r\n\t\tCompute.Addresses.Insert call = computeService.addresses().insert(\"example-project\", \"example-region\", address);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.addresses.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\naddress = {} # construct your object here\r\nrequest = service.addresses().insert(body=address, project=\"example-project\", region=\"example-region\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.addresses.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var address = new Address();\r\n // Add your code to populate the address object\r\n var call = computeService.Addresses.Insert(address, \"example-project\", \"example-region\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.addresses.list.snippet.json b/compute.addresses.list.snippet.json new file mode 100644 index 0000000..be1d650 --- /dev/null +++ b/compute.addresses.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.addresses.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tAddressList response;\r\n\t\tCompute.Addresses.List request = computeService.addresses().list(\"example-project\", \"example-region\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Address item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.addresses.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.addresses().list(project=\"example-project\", region=\"example-region\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.addresses().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.addresses.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n AddressList response;\r\n var request = computeService.Addresses.List(\"example-project\", \"example-region\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.autoscalers.aggregatedList.snippet.json b/compute.autoscalers.aggregatedList.snippet.json new file mode 100644 index 0000000..ebd86c3 --- /dev/null +++ b/compute.autoscalers.aggregatedList.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.autoscalers.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tAutoscalerAggregatedList response;\r\n\t\tCompute.Autoscalers.AggregatedList request = computeService.autoscalers().aggregatedList(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems().values() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (AutoscalersScopedList item : response.getItems().values()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.autoscalers.aggregatedList\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.autoscalers().aggregatedList(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.autoscalers().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.autoscalers.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n AutoscalerAggregatedList response;\r\n var request = computeService.Autoscalers.AggregatedList(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items.Values == null)\r\n continue;\r\n\r\n foreach (var item in response.Items.Values)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.autoscalers.delete.snippet.json b/compute.autoscalers.delete.snippet.json new file mode 100644 index 0000000..f720ec9 --- /dev/null +++ b/compute.autoscalers.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.autoscalers.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Autoscalers.Delete request = computeService.autoscalers().delete(\"example-project\", \"us-central1-a\", \"example-autoscaler\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.autoscalers.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.autoscalers().delete(project=\"example-project\", zone=\"us-central1-a\", autoscaler=\"example-autoscaler\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.autoscalers.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Autoscalers.Delete(\"example-project\", \"us-central1-a\", \"example-autoscaler\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.autoscalers.get.snippet.json b/compute.autoscalers.get.snippet.json new file mode 100644 index 0000000..36218b4 --- /dev/null +++ b/compute.autoscalers.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.autoscalers.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Autoscalers.Get request = computeService.autoscalers().get(\"example-project\", \"us-central1-a\", \"example-autoscaler\");\r\n\t\tAutoscaler response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.autoscalers.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.autoscalers().get(project=\"example-project\", zone=\"us-central1-a\", autoscaler=\"example-autoscaler\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.autoscalers.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Autoscalers.Get(\"example-project\", \"us-central1-a\", \"example-autoscaler\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.autoscalers.insert.snippet.json b/compute.autoscalers.insert.snippet.json new file mode 100644 index 0000000..41c1d76 --- /dev/null +++ b/compute.autoscalers.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.autoscalers.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tAutoscaler autoscaler = new Autoscaler();\r\n\t\t// Add your code to populate the autoscaler object\r\n\t\tCompute.Autoscalers.Insert call = computeService.autoscalers().insert(\"example-project\", \"us-central1-a\", autoscaler);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.autoscalers.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nautoscaler = {} # construct your object here\r\nrequest = service.autoscalers().insert(body=autoscaler, project=\"example-project\", zone=\"us-central1-a\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.autoscalers.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var autoscaler = new Autoscaler();\r\n // Add your code to populate the autoscaler object\r\n var call = computeService.Autoscalers.Insert(autoscaler, \"example-project\", \"us-central1-a\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.autoscalers.list.snippet.json b/compute.autoscalers.list.snippet.json new file mode 100644 index 0000000..8ba2dd7 --- /dev/null +++ b/compute.autoscalers.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.autoscalers.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tAutoscalerList response;\r\n\t\tCompute.Autoscalers.List request = computeService.autoscalers().list(\"example-project\", \"us-central1-a\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Autoscaler item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.autoscalers.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.autoscalers().list(project=\"example-project\", zone=\"us-central1-a\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.autoscalers().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.autoscalers.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n AutoscalerList response;\r\n var request = computeService.Autoscalers.List(\"example-project\", \"us-central1-a\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.autoscalers.patch.snippet.json b/compute.autoscalers.patch.snippet.json new file mode 100644 index 0000000..c3c25ba --- /dev/null +++ b/compute.autoscalers.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.autoscalers.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\t// Obtain the Autoscaler object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tCompute.Autoscalers.Patch request = computeService.autoscalers().patch(\"example-project\", \"us-central1-a\", \"example-autoscaler\", autoscaler);\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.autoscalers.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\n# Obtain the autoscaler object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.autoscalers().patch(body=autoscaler, project=\"example-project\", zone=\"us-central1-a\", autoscaler=\"example-autoscaler\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.autoscalers.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the Autoscaler object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = computeService.Autoscalers.Patch(autoscaler, \"example-project\", \"us-central1-a\", \"example-autoscaler\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.autoscalers.update.snippet.json b/compute.autoscalers.update.snippet.json new file mode 100644 index 0000000..737cb6f --- /dev/null +++ b/compute.autoscalers.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.autoscalers.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tAutoscaler autoscaler = new Autoscaler();\r\n\t\t// Add your code to populate the autoscaler object\r\n\t\tCompute.Autoscalers.Update call = computeService.autoscalers().update(\"example-project\", \"us-central1-a\", autoscaler);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.autoscalers.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nautoscaler = {} # construct your object here\r\nrequest = service.autoscalers().update(body=autoscaler, project=\"example-project\", zone=\"us-central1-a\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.autoscalers.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var autoscaler = new Autoscaler();\r\n // Add your code to populate the autoscaler object\r\n var call = computeService.Autoscalers.Update(autoscaler, \"example-project\", \"us-central1-a\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.backendServices.delete.snippet.json b/compute.backendServices.delete.snippet.json new file mode 100644 index 0000000..07994f4 --- /dev/null +++ b/compute.backendServices.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.backendServices.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.BackendServices.Delete request = computeService.backendServices().delete(\"example-project\", \"example-backendService\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.backendServices.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.backendServices().delete(project=\"example-project\", backendService=\"example-backendService\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.backendServices.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.BackendServices.Delete(\"example-project\", \"example-backendService\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.backendServices.get.snippet.json b/compute.backendServices.get.snippet.json new file mode 100644 index 0000000..c04ccfa --- /dev/null +++ b/compute.backendServices.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.backendServices.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.BackendServices.Get request = computeService.backendServices().get(\"example-project\", \"example-backendService\");\r\n\t\tBackendService response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.backendServices.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.backendServices().get(project=\"example-project\", backendService=\"example-backendService\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.backendServices.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.BackendServices.Get(\"example-project\", \"example-backendService\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.backendServices.getHealth.snippet.json b/compute.backendServices.getHealth.snippet.json new file mode 100644 index 0000000..c46e6b0 --- /dev/null +++ b/compute.backendServices.getHealth.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.backendServices.getHealth\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tResourceGroupReference resourceGroupReference = new ResourceGroupReference();\r\n\t\t// Add your code to populate the resourceGroupReference object\r\n\t\tCompute.BackendServices.GetHealth call = computeService.backendServices().getHealth(\"example-project\", \"example-backendService\", resourceGroupReference);\r\n\t\tBackendServiceGroupHealth response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.backendServices.getHealth\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nresource_group_reference = {} # construct your object here\r\nrequest = service.backendServices().getHealth(body=resource_group_reference, project=\"example-project\", backendService=\"example-backendService\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.backendServices.getHealth\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var resourceGroupReference = new ResourceGroupReference();\r\n // Add your code to populate the resourceGroupReference object\r\n var call = computeService.BackendServices.GetHealth(resourceGroupReference, \"example-project\", \"example-backendService\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.backendServices.insert.snippet.json b/compute.backendServices.insert.snippet.json new file mode 100644 index 0000000..c66fe3e --- /dev/null +++ b/compute.backendServices.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.backendServices.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tBackendService backendService = new BackendService();\r\n\t\t// Add your code to populate the backendService object\r\n\t\tCompute.BackendServices.Insert call = computeService.backendServices().insert(\"example-project\", backendService);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.backendServices.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nbackend_service = {} # construct your object here\r\nrequest = service.backendServices().insert(body=backend_service, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.backendServices.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var backendService = new BackendService();\r\n // Add your code to populate the backendService object\r\n var call = computeService.BackendServices.Insert(backendService, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.backendServices.list.snippet.json b/compute.backendServices.list.snippet.json new file mode 100644 index 0000000..a8d7078 --- /dev/null +++ b/compute.backendServices.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.backendServices.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tBackendServiceList response;\r\n\t\tCompute.BackendServices.List request = computeService.backendServices().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (BackendService item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.backendServices.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.backendServices().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.backendServices().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.backendServices.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n BackendServiceList response;\r\n var request = computeService.BackendServices.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.backendServices.patch.snippet.json b/compute.backendServices.patch.snippet.json new file mode 100644 index 0000000..9fed399 --- /dev/null +++ b/compute.backendServices.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.backendServices.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\t// Obtain the BackendService object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tCompute.BackendServices.Patch request = computeService.backendServices().patch(\"example-project\", \"example-backendService\", backendService);\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.backendServices.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\n# Obtain the backend_service object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.backendServices().patch(body=backend_service, project=\"example-project\", backendService=\"example-backendService\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.backendServices.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the BackendService object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = computeService.BackendServices.Patch(backendService, \"example-project\", \"example-backendService\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.backendServices.update.snippet.json b/compute.backendServices.update.snippet.json new file mode 100644 index 0000000..856852b --- /dev/null +++ b/compute.backendServices.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.backendServices.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tBackendService backendService = new BackendService();\r\n\t\t// Add your code to populate the backendService object\r\n\t\tCompute.BackendServices.Update call = computeService.backendServices().update(\"example-project\", \"example-backendService\", backendService);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.backendServices.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nbackend_service = {} # construct your object here\r\nrequest = service.backendServices().update(body=backend_service, project=\"example-project\", backendService=\"example-backendService\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.backendServices.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var backendService = new BackendService();\r\n // Add your code to populate the backendService object\r\n var call = computeService.BackendServices.Update(backendService, \"example-project\", \"example-backendService\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.diskTypes.aggregatedList.snippet.json b/compute.diskTypes.aggregatedList.snippet.json new file mode 100644 index 0000000..5aefec8 --- /dev/null +++ b/compute.diskTypes.aggregatedList.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.diskTypes.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tDiskTypeAggregatedList response;\r\n\t\tCompute.DiskTypes.AggregatedList request = computeService.diskTypes().aggregatedList(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems().values() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (DiskTypesScopedList item : response.getItems().values()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.diskTypes.aggregatedList\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.diskTypes().aggregatedList(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.diskTypes().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.diskTypes.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n DiskTypeAggregatedList response;\r\n var request = computeService.DiskTypes.AggregatedList(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items.Values == null)\r\n continue;\r\n\r\n foreach (var item in response.Items.Values)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.diskTypes.get.snippet.json b/compute.diskTypes.get.snippet.json new file mode 100644 index 0000000..625bb2c --- /dev/null +++ b/compute.diskTypes.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.diskTypes.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.DiskTypes.Get request = computeService.diskTypes().get(\"example-project\", \"us-central1-a\", \"example-diskType\");\r\n\t\tDiskType response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.diskTypes.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.diskTypes().get(project=\"example-project\", zone=\"us-central1-a\", diskType=\"example-diskType\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.diskTypes.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.DiskTypes.Get(\"example-project\", \"us-central1-a\", \"example-diskType\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.diskTypes.list.snippet.json b/compute.diskTypes.list.snippet.json new file mode 100644 index 0000000..6ec35df --- /dev/null +++ b/compute.diskTypes.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.diskTypes.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tDiskTypeList response;\r\n\t\tCompute.DiskTypes.List request = computeService.diskTypes().list(\"example-project\", \"us-central1-a\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (DiskType item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.diskTypes.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.diskTypes().list(project=\"example-project\", zone=\"us-central1-a\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.diskTypes().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.diskTypes.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n DiskTypeList response;\r\n var request = computeService.DiskTypes.List(\"example-project\", \"us-central1-a\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.disks.aggregatedList.snippet.json b/compute.disks.aggregatedList.snippet.json new file mode 100644 index 0000000..3232a93 --- /dev/null +++ b/compute.disks.aggregatedList.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.disks.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tDiskAggregatedList response;\r\n\t\tCompute.Disks.AggregatedList request = computeService.disks().aggregatedList(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems().values() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (DisksScopedList item : response.getItems().values()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.disks.aggregatedList\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.disks().aggregatedList(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.disks().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.disks.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n DiskAggregatedList response;\r\n var request = computeService.Disks.AggregatedList(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items.Values == null)\r\n continue;\r\n\r\n foreach (var item in response.Items.Values)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.disks.createSnapshot.snippet.json b/compute.disks.createSnapshot.snippet.json new file mode 100644 index 0000000..2551f2c --- /dev/null +++ b/compute.disks.createSnapshot.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.disks.createSnapshot\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tSnapshot snapshot = new Snapshot();\r\n\t\t// Add your code to populate the snapshot object\r\n\t\tCompute.Disks.CreateSnapshot call = computeService.disks().createSnapshot(\"example-project\", \"us-central1-a\", \"example-disk\", snapshot);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.disks.createSnapshot\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nsnapshot = {} # construct your object here\r\nrequest = service.disks().createSnapshot(body=snapshot, project=\"example-project\", zone=\"us-central1-a\", disk=\"example-disk\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.disks.createSnapshot\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var snapshot = new Snapshot();\r\n // Add your code to populate the snapshot object\r\n var call = computeService.Disks.CreateSnapshot(snapshot, \"example-project\", \"us-central1-a\", \"example-disk\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.disks.delete.snippet.json b/compute.disks.delete.snippet.json new file mode 100644 index 0000000..e5f846f --- /dev/null +++ b/compute.disks.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.disks.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Disks.Delete request = computeService.disks().delete(\"example-project\", \"us-central1-a\", \"example-disk\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.disks.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.disks().delete(project=\"example-project\", zone=\"us-central1-a\", disk=\"example-disk\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.disks.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Disks.Delete(\"example-project\", \"us-central1-a\", \"example-disk\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.disks.get.snippet.json b/compute.disks.get.snippet.json new file mode 100644 index 0000000..8472378 --- /dev/null +++ b/compute.disks.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.disks.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Disks.Get request = computeService.disks().get(\"example-project\", \"us-central1-a\", \"example-disk\");\r\n\t\tDisk response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.disks.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.disks().get(project=\"example-project\", zone=\"us-central1-a\", disk=\"example-disk\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.disks.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Disks.Get(\"example-project\", \"us-central1-a\", \"example-disk\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.disks.insert.snippet.json b/compute.disks.insert.snippet.json new file mode 100644 index 0000000..5963223 --- /dev/null +++ b/compute.disks.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.disks.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tDisk disk = new Disk();\r\n\t\t// Add your code to populate the disk object\r\n\t\tCompute.Disks.Insert call = computeService.disks().insert(\"example-project\", \"us-central1-a\", disk);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.disks.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ndisk = {} # construct your object here\r\nrequest = service.disks().insert(body=disk, project=\"example-project\", zone=\"us-central1-a\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.disks.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var disk = new Disk();\r\n // Add your code to populate the disk object\r\n var call = computeService.Disks.Insert(disk, \"example-project\", \"us-central1-a\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.disks.list.snippet.json b/compute.disks.list.snippet.json new file mode 100644 index 0000000..46de55d --- /dev/null +++ b/compute.disks.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.disks.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tDiskList response;\r\n\t\tCompute.Disks.List request = computeService.disks().list(\"example-project\", \"us-central1-a\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Disk item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.disks.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.disks().list(project=\"example-project\", zone=\"us-central1-a\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.disks().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.disks.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n DiskList response;\r\n var request = computeService.Disks.List(\"example-project\", \"us-central1-a\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.firewalls.delete.snippet.json b/compute.firewalls.delete.snippet.json new file mode 100644 index 0000000..ba06761 --- /dev/null +++ b/compute.firewalls.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.firewalls.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Firewalls.Delete request = computeService.firewalls().delete(\"example-project\", \"example-firewall\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.firewalls.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.firewalls().delete(project=\"example-project\", firewall=\"example-firewall\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.firewalls.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Firewalls.Delete(\"example-project\", \"example-firewall\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.firewalls.get.snippet.json b/compute.firewalls.get.snippet.json new file mode 100644 index 0000000..09654af --- /dev/null +++ b/compute.firewalls.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.firewalls.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Firewalls.Get request = computeService.firewalls().get(\"example-project\", \"example-firewall\");\r\n\t\tFirewall response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.firewalls.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.firewalls().get(project=\"example-project\", firewall=\"example-firewall\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.firewalls.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Firewalls.Get(\"example-project\", \"example-firewall\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.firewalls.insert.snippet.json b/compute.firewalls.insert.snippet.json new file mode 100644 index 0000000..898dd8b --- /dev/null +++ b/compute.firewalls.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.firewalls.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tFirewall firewall = new Firewall();\r\n\t\t// Add your code to populate the firewall object\r\n\t\tCompute.Firewalls.Insert call = computeService.firewalls().insert(\"example-project\", firewall);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.firewalls.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nfirewall = {} # construct your object here\r\nrequest = service.firewalls().insert(body=firewall, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.firewalls.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var firewall = new Firewall();\r\n // Add your code to populate the firewall object\r\n var call = computeService.Firewalls.Insert(firewall, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.firewalls.list.snippet.json b/compute.firewalls.list.snippet.json new file mode 100644 index 0000000..6b5da9f --- /dev/null +++ b/compute.firewalls.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.firewalls.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tFirewallList response;\r\n\t\tCompute.Firewalls.List request = computeService.firewalls().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Firewall item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.firewalls.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.firewalls().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.firewalls().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.firewalls.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n FirewallList response;\r\n var request = computeService.Firewalls.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.firewalls.patch.snippet.json b/compute.firewalls.patch.snippet.json new file mode 100644 index 0000000..c162df7 --- /dev/null +++ b/compute.firewalls.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.firewalls.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\t// Obtain the Firewall object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tCompute.Firewalls.Patch request = computeService.firewalls().patch(\"example-project\", \"example-firewall\", firewall);\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.firewalls.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\n# Obtain the firewall object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.firewalls().patch(body=firewall, project=\"example-project\", firewall=\"example-firewall\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.firewalls.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the Firewall object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = computeService.Firewalls.Patch(firewall, \"example-project\", \"example-firewall\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.firewalls.update.snippet.json b/compute.firewalls.update.snippet.json new file mode 100644 index 0000000..153ef90 --- /dev/null +++ b/compute.firewalls.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.firewalls.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tFirewall firewall = new Firewall();\r\n\t\t// Add your code to populate the firewall object\r\n\t\tCompute.Firewalls.Update call = computeService.firewalls().update(\"example-project\", \"example-firewall\", firewall);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.firewalls.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nfirewall = {} # construct your object here\r\nrequest = service.firewalls().update(body=firewall, project=\"example-project\", firewall=\"example-firewall\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.firewalls.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var firewall = new Firewall();\r\n // Add your code to populate the firewall object\r\n var call = computeService.Firewalls.Update(firewall, \"example-project\", \"example-firewall\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.forwardingRules.aggregatedList.snippet.json b/compute.forwardingRules.aggregatedList.snippet.json new file mode 100644 index 0000000..9dcb0bf --- /dev/null +++ b/compute.forwardingRules.aggregatedList.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.forwardingRules.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tForwardingRuleAggregatedList response;\r\n\t\tCompute.ForwardingRules.AggregatedList request = computeService.forwardingRules().aggregatedList(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems().values() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (ForwardingRulesScopedList item : response.getItems().values()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.forwardingRules.aggregatedList\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.forwardingRules().aggregatedList(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.forwardingRules().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.forwardingRules.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ForwardingRuleAggregatedList response;\r\n var request = computeService.ForwardingRules.AggregatedList(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items.Values == null)\r\n continue;\r\n\r\n foreach (var item in response.Items.Values)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.forwardingRules.delete.snippet.json b/compute.forwardingRules.delete.snippet.json new file mode 100644 index 0000000..e2f30d5 --- /dev/null +++ b/compute.forwardingRules.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.forwardingRules.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.ForwardingRules.Delete request = computeService.forwardingRules().delete(\"example-project\", \"example-region\", \"example-forwardingRule\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.forwardingRules.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.forwardingRules().delete(project=\"example-project\", region=\"example-region\", forwardingRule=\"example-forwardingRule\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.forwardingRules.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.ForwardingRules.Delete(\"example-project\", \"example-region\", \"example-forwardingRule\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.forwardingRules.get.snippet.json b/compute.forwardingRules.get.snippet.json new file mode 100644 index 0000000..645ab7b --- /dev/null +++ b/compute.forwardingRules.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.forwardingRules.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.ForwardingRules.Get request = computeService.forwardingRules().get(\"example-project\", \"example-region\", \"example-forwardingRule\");\r\n\t\tForwardingRule response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.forwardingRules.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.forwardingRules().get(project=\"example-project\", region=\"example-region\", forwardingRule=\"example-forwardingRule\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.forwardingRules.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.ForwardingRules.Get(\"example-project\", \"example-region\", \"example-forwardingRule\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.forwardingRules.insert.snippet.json b/compute.forwardingRules.insert.snippet.json new file mode 100644 index 0000000..a7cabd3 --- /dev/null +++ b/compute.forwardingRules.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.forwardingRules.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tForwardingRule forwardingRule = new ForwardingRule();\r\n\t\t// Add your code to populate the forwardingRule object\r\n\t\tCompute.ForwardingRules.Insert call = computeService.forwardingRules().insert(\"example-project\", \"example-region\", forwardingRule);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.forwardingRules.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nforwarding_rule = {} # construct your object here\r\nrequest = service.forwardingRules().insert(body=forwarding_rule, project=\"example-project\", region=\"example-region\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.forwardingRules.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var forwardingRule = new ForwardingRule();\r\n // Add your code to populate the forwardingRule object\r\n var call = computeService.ForwardingRules.Insert(forwardingRule, \"example-project\", \"example-region\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.forwardingRules.list.snippet.json b/compute.forwardingRules.list.snippet.json new file mode 100644 index 0000000..4c5c52a --- /dev/null +++ b/compute.forwardingRules.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.forwardingRules.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tForwardingRuleList response;\r\n\t\tCompute.ForwardingRules.List request = computeService.forwardingRules().list(\"example-project\", \"example-region\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (ForwardingRule item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.forwardingRules.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.forwardingRules().list(project=\"example-project\", region=\"example-region\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.forwardingRules().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.forwardingRules.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ForwardingRuleList response;\r\n var request = computeService.ForwardingRules.List(\"example-project\", \"example-region\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.forwardingRules.setTarget.snippet.json b/compute.forwardingRules.setTarget.snippet.json new file mode 100644 index 0000000..0580ec8 --- /dev/null +++ b/compute.forwardingRules.setTarget.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.forwardingRules.setTarget\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetReference targetReference = new TargetReference();\r\n\t\t// Add your code to populate the targetReference object\r\n\t\tCompute.ForwardingRules.SetTarget call = computeService.forwardingRules().setTarget(\"example-project\", \"example-region\", \"example-forwardingRule\", targetReference);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.forwardingRules.setTarget\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ntarget_reference = {} # construct your object here\r\nrequest = service.forwardingRules().setTarget(body=target_reference, project=\"example-project\", region=\"example-region\", forwardingRule=\"example-forwardingRule\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.forwardingRules.setTarget\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var targetReference = new TargetReference();\r\n // Add your code to populate the targetReference object\r\n var call = computeService.ForwardingRules.SetTarget(targetReference, \"example-project\", \"example-region\", \"example-forwardingRule\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.globalAddresses.delete.snippet.json b/compute.globalAddresses.delete.snippet.json new file mode 100644 index 0000000..22df153 --- /dev/null +++ b/compute.globalAddresses.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.globalAddresses.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.GlobalAddresses.Delete request = computeService.globalAddresses().delete(\"example-project\", \"example-address\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.globalAddresses.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.globalAddresses().delete(project=\"example-project\", address=\"example-address\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.globalAddresses.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.GlobalAddresses.Delete(\"example-project\", \"example-address\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.globalAddresses.get.snippet.json b/compute.globalAddresses.get.snippet.json new file mode 100644 index 0000000..13406ce --- /dev/null +++ b/compute.globalAddresses.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.globalAddresses.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.GlobalAddresses.Get request = computeService.globalAddresses().get(\"example-project\", \"example-address\");\r\n\t\tAddress response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.globalAddresses.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.globalAddresses().get(project=\"example-project\", address=\"example-address\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.globalAddresses.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.GlobalAddresses.Get(\"example-project\", \"example-address\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.globalAddresses.insert.snippet.json b/compute.globalAddresses.insert.snippet.json new file mode 100644 index 0000000..5a8ab27 --- /dev/null +++ b/compute.globalAddresses.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.globalAddresses.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tAddress address = new Address();\r\n\t\t// Add your code to populate the address object\r\n\t\tCompute.GlobalAddresses.Insert call = computeService.globalAddresses().insert(\"example-project\", address);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.globalAddresses.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\naddress = {} # construct your object here\r\nrequest = service.globalAddresses().insert(body=address, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.globalAddresses.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var address = new Address();\r\n // Add your code to populate the address object\r\n var call = computeService.GlobalAddresses.Insert(address, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.globalAddresses.list.snippet.json b/compute.globalAddresses.list.snippet.json new file mode 100644 index 0000000..5e06c7b --- /dev/null +++ b/compute.globalAddresses.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.globalAddresses.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tAddressList response;\r\n\t\tCompute.GlobalAddresses.List request = computeService.globalAddresses().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Address item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.globalAddresses.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.globalAddresses().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.globalAddresses().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.globalAddresses.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n AddressList response;\r\n var request = computeService.GlobalAddresses.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.globalForwardingRules.delete.snippet.json b/compute.globalForwardingRules.delete.snippet.json new file mode 100644 index 0000000..9c720c1 --- /dev/null +++ b/compute.globalForwardingRules.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.globalForwardingRules.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.GlobalForwardingRules.Delete request = computeService.globalForwardingRules().delete(\"example-project\", \"example-forwardingRule\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.globalForwardingRules.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.globalForwardingRules().delete(project=\"example-project\", forwardingRule=\"example-forwardingRule\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.globalForwardingRules.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.GlobalForwardingRules.Delete(\"example-project\", \"example-forwardingRule\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.globalForwardingRules.get.snippet.json b/compute.globalForwardingRules.get.snippet.json new file mode 100644 index 0000000..4cb2dd7 --- /dev/null +++ b/compute.globalForwardingRules.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.globalForwardingRules.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.GlobalForwardingRules.Get request = computeService.globalForwardingRules().get(\"example-project\", \"example-forwardingRule\");\r\n\t\tForwardingRule response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.globalForwardingRules.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.globalForwardingRules().get(project=\"example-project\", forwardingRule=\"example-forwardingRule\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.globalForwardingRules.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.GlobalForwardingRules.Get(\"example-project\", \"example-forwardingRule\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.globalForwardingRules.insert.snippet.json b/compute.globalForwardingRules.insert.snippet.json new file mode 100644 index 0000000..f246833 --- /dev/null +++ b/compute.globalForwardingRules.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.globalForwardingRules.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tForwardingRule forwardingRule = new ForwardingRule();\r\n\t\t// Add your code to populate the forwardingRule object\r\n\t\tCompute.GlobalForwardingRules.Insert call = computeService.globalForwardingRules().insert(\"example-project\", forwardingRule);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.globalForwardingRules.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nforwarding_rule = {} # construct your object here\r\nrequest = service.globalForwardingRules().insert(body=forwarding_rule, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.globalForwardingRules.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var forwardingRule = new ForwardingRule();\r\n // Add your code to populate the forwardingRule object\r\n var call = computeService.GlobalForwardingRules.Insert(forwardingRule, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.globalForwardingRules.list.snippet.json b/compute.globalForwardingRules.list.snippet.json new file mode 100644 index 0000000..f2a2ea6 --- /dev/null +++ b/compute.globalForwardingRules.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.globalForwardingRules.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tForwardingRuleList response;\r\n\t\tCompute.GlobalForwardingRules.List request = computeService.globalForwardingRules().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (ForwardingRule item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.globalForwardingRules.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.globalForwardingRules().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.globalForwardingRules().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.globalForwardingRules.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ForwardingRuleList response;\r\n var request = computeService.GlobalForwardingRules.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.globalForwardingRules.setTarget.snippet.json b/compute.globalForwardingRules.setTarget.snippet.json new file mode 100644 index 0000000..bb2b194 --- /dev/null +++ b/compute.globalForwardingRules.setTarget.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.globalForwardingRules.setTarget\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetReference targetReference = new TargetReference();\r\n\t\t// Add your code to populate the targetReference object\r\n\t\tCompute.GlobalForwardingRules.SetTarget call = computeService.globalForwardingRules().setTarget(\"example-project\", \"example-forwardingRule\", targetReference);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.globalForwardingRules.setTarget\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ntarget_reference = {} # construct your object here\r\nrequest = service.globalForwardingRules().setTarget(body=target_reference, project=\"example-project\", forwardingRule=\"example-forwardingRule\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.globalForwardingRules.setTarget\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var targetReference = new TargetReference();\r\n // Add your code to populate the targetReference object\r\n var call = computeService.GlobalForwardingRules.SetTarget(targetReference, \"example-project\", \"example-forwardingRule\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.globalOperations.aggregatedList.snippet.json b/compute.globalOperations.aggregatedList.snippet.json new file mode 100644 index 0000000..6349873 --- /dev/null +++ b/compute.globalOperations.aggregatedList.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.globalOperations.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tOperationAggregatedList response;\r\n\t\tCompute.GlobalOperations.AggregatedList request = computeService.globalOperations().aggregatedList(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems().values() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (OperationsScopedList item : response.getItems().values()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.globalOperations.aggregatedList\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.globalOperations().aggregatedList(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.globalOperations().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.globalOperations.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n OperationAggregatedList response;\r\n var request = computeService.GlobalOperations.AggregatedList(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items.Values == null)\r\n continue;\r\n\r\n foreach (var item in response.Items.Values)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.globalOperations.delete.snippet.json b/compute.globalOperations.delete.snippet.json new file mode 100644 index 0000000..598bab3 --- /dev/null +++ b/compute.globalOperations.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.globalOperations.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.GlobalOperations.Delete request = computeService.globalOperations().delete(\"example-project\", \"example-operation\");\r\n\t\t response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.globalOperations.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.globalOperations().delete(project=\"example-project\", operation=\"example-operation\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.globalOperations.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.GlobalOperations.Delete(\"example-project\", \"example-operation\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.globalOperations.get.snippet.json b/compute.globalOperations.get.snippet.json new file mode 100644 index 0000000..dc0574e --- /dev/null +++ b/compute.globalOperations.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.globalOperations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.GlobalOperations.Get request = computeService.globalOperations().get(\"example-project\", \"example-operation\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.globalOperations.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.globalOperations().get(project=\"example-project\", operation=\"example-operation\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.globalOperations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.GlobalOperations.Get(\"example-project\", \"example-operation\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.globalOperations.list.snippet.json b/compute.globalOperations.list.snippet.json new file mode 100644 index 0000000..f6a6b52 --- /dev/null +++ b/compute.globalOperations.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.globalOperations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tOperationList response;\r\n\t\tCompute.GlobalOperations.List request = computeService.globalOperations().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Operation item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.globalOperations.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.globalOperations().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.globalOperations().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.globalOperations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n OperationList response;\r\n var request = computeService.GlobalOperations.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.httpHealthChecks.delete.snippet.json b/compute.httpHealthChecks.delete.snippet.json new file mode 100644 index 0000000..837426c --- /dev/null +++ b/compute.httpHealthChecks.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.httpHealthChecks.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.HttpHealthChecks.Delete request = computeService.httpHealthChecks().delete(\"example-project\", \"example-httpHealthCheck\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.httpHealthChecks.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.httpHealthChecks().delete(project=\"example-project\", httpHealthCheck=\"example-httpHealthCheck\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.httpHealthChecks.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.HttpHealthChecks.Delete(\"example-project\", \"example-httpHealthCheck\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.httpHealthChecks.get.snippet.json b/compute.httpHealthChecks.get.snippet.json new file mode 100644 index 0000000..8f43447 --- /dev/null +++ b/compute.httpHealthChecks.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.httpHealthChecks.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.HttpHealthChecks.Get request = computeService.httpHealthChecks().get(\"example-project\", \"example-httpHealthCheck\");\r\n\t\tHttpHealthCheck response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.httpHealthChecks.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.httpHealthChecks().get(project=\"example-project\", httpHealthCheck=\"example-httpHealthCheck\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.httpHealthChecks.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.HttpHealthChecks.Get(\"example-project\", \"example-httpHealthCheck\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.httpHealthChecks.insert.snippet.json b/compute.httpHealthChecks.insert.snippet.json new file mode 100644 index 0000000..1661f59 --- /dev/null +++ b/compute.httpHealthChecks.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.httpHealthChecks.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tHttpHealthCheck httpHealthCheck = new HttpHealthCheck();\r\n\t\t// Add your code to populate the httpHealthCheck object\r\n\t\tCompute.HttpHealthChecks.Insert call = computeService.httpHealthChecks().insert(\"example-project\", httpHealthCheck);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.httpHealthChecks.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nhttp_health_check = {} # construct your object here\r\nrequest = service.httpHealthChecks().insert(body=http_health_check, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.httpHealthChecks.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var httpHealthCheck = new HttpHealthCheck();\r\n // Add your code to populate the httpHealthCheck object\r\n var call = computeService.HttpHealthChecks.Insert(httpHealthCheck, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.httpHealthChecks.list.snippet.json b/compute.httpHealthChecks.list.snippet.json new file mode 100644 index 0000000..1bc0e92 --- /dev/null +++ b/compute.httpHealthChecks.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.httpHealthChecks.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tHttpHealthCheckList response;\r\n\t\tCompute.HttpHealthChecks.List request = computeService.httpHealthChecks().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (HttpHealthCheck item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.httpHealthChecks.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.httpHealthChecks().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.httpHealthChecks().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.httpHealthChecks.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n HttpHealthCheckList response;\r\n var request = computeService.HttpHealthChecks.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.httpHealthChecks.patch.snippet.json b/compute.httpHealthChecks.patch.snippet.json new file mode 100644 index 0000000..ec7223f --- /dev/null +++ b/compute.httpHealthChecks.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.httpHealthChecks.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\t// Obtain the HttpHealthCheck object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tCompute.HttpHealthChecks.Patch request = computeService.httpHealthChecks().patch(\"example-project\", \"example-httpHealthCheck\", httpHealthCheck);\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.httpHealthChecks.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\n# Obtain the http_health_check object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.httpHealthChecks().patch(body=http_health_check, project=\"example-project\", httpHealthCheck=\"example-httpHealthCheck\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.httpHealthChecks.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the HttpHealthCheck object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = computeService.HttpHealthChecks.Patch(httpHealthCheck, \"example-project\", \"example-httpHealthCheck\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.httpHealthChecks.update.snippet.json b/compute.httpHealthChecks.update.snippet.json new file mode 100644 index 0000000..61c7dd0 --- /dev/null +++ b/compute.httpHealthChecks.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.httpHealthChecks.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tHttpHealthCheck httpHealthCheck = new HttpHealthCheck();\r\n\t\t// Add your code to populate the httpHealthCheck object\r\n\t\tCompute.HttpHealthChecks.Update call = computeService.httpHealthChecks().update(\"example-project\", \"example-httpHealthCheck\", httpHealthCheck);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.httpHealthChecks.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nhttp_health_check = {} # construct your object here\r\nrequest = service.httpHealthChecks().update(body=http_health_check, project=\"example-project\", httpHealthCheck=\"example-httpHealthCheck\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.httpHealthChecks.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var httpHealthCheck = new HttpHealthCheck();\r\n // Add your code to populate the httpHealthCheck object\r\n var call = computeService.HttpHealthChecks.Update(httpHealthCheck, \"example-project\", \"example-httpHealthCheck\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.httpsHealthChecks.delete.snippet.json b/compute.httpsHealthChecks.delete.snippet.json new file mode 100644 index 0000000..b5618fd --- /dev/null +++ b/compute.httpsHealthChecks.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.httpsHealthChecks.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.HttpsHealthChecks.Delete request = computeService.httpsHealthChecks().delete(\"example-project\", \"example-httpsHealthCheck\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.httpsHealthChecks.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.httpsHealthChecks().delete(project=\"example-project\", httpsHealthCheck=\"example-httpsHealthCheck\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.httpsHealthChecks.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.HttpsHealthChecks.Delete(\"example-project\", \"example-httpsHealthCheck\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.httpsHealthChecks.get.snippet.json b/compute.httpsHealthChecks.get.snippet.json new file mode 100644 index 0000000..b11782e --- /dev/null +++ b/compute.httpsHealthChecks.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.httpsHealthChecks.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.HttpsHealthChecks.Get request = computeService.httpsHealthChecks().get(\"example-project\", \"example-httpsHealthCheck\");\r\n\t\tHttpsHealthCheck response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.httpsHealthChecks.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.httpsHealthChecks().get(project=\"example-project\", httpsHealthCheck=\"example-httpsHealthCheck\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.httpsHealthChecks.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.HttpsHealthChecks.Get(\"example-project\", \"example-httpsHealthCheck\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.httpsHealthChecks.insert.snippet.json b/compute.httpsHealthChecks.insert.snippet.json new file mode 100644 index 0000000..b9700a9 --- /dev/null +++ b/compute.httpsHealthChecks.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.httpsHealthChecks.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tHttpsHealthCheck httpsHealthCheck = new HttpsHealthCheck();\r\n\t\t// Add your code to populate the httpsHealthCheck object\r\n\t\tCompute.HttpsHealthChecks.Insert call = computeService.httpsHealthChecks().insert(\"example-project\", httpsHealthCheck);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.httpsHealthChecks.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nhttps_health_check = {} # construct your object here\r\nrequest = service.httpsHealthChecks().insert(body=https_health_check, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.httpsHealthChecks.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var httpsHealthCheck = new HttpsHealthCheck();\r\n // Add your code to populate the httpsHealthCheck object\r\n var call = computeService.HttpsHealthChecks.Insert(httpsHealthCheck, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.httpsHealthChecks.list.snippet.json b/compute.httpsHealthChecks.list.snippet.json new file mode 100644 index 0000000..689b8af --- /dev/null +++ b/compute.httpsHealthChecks.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.httpsHealthChecks.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tHttpsHealthCheckList response;\r\n\t\tCompute.HttpsHealthChecks.List request = computeService.httpsHealthChecks().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (HttpsHealthCheck item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.httpsHealthChecks.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.httpsHealthChecks().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.httpsHealthChecks().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.httpsHealthChecks.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n HttpsHealthCheckList response;\r\n var request = computeService.HttpsHealthChecks.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.httpsHealthChecks.patch.snippet.json b/compute.httpsHealthChecks.patch.snippet.json new file mode 100644 index 0000000..d6be839 --- /dev/null +++ b/compute.httpsHealthChecks.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.httpsHealthChecks.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\t// Obtain the HttpsHealthCheck object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tCompute.HttpsHealthChecks.Patch request = computeService.httpsHealthChecks().patch(\"example-project\", \"example-httpsHealthCheck\", httpsHealthCheck);\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.httpsHealthChecks.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\n# Obtain the https_health_check object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.httpsHealthChecks().patch(body=https_health_check, project=\"example-project\", httpsHealthCheck=\"example-httpsHealthCheck\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.httpsHealthChecks.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the HttpsHealthCheck object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = computeService.HttpsHealthChecks.Patch(httpsHealthCheck, \"example-project\", \"example-httpsHealthCheck\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.httpsHealthChecks.update.snippet.json b/compute.httpsHealthChecks.update.snippet.json new file mode 100644 index 0000000..448fd87 --- /dev/null +++ b/compute.httpsHealthChecks.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.httpsHealthChecks.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tHttpsHealthCheck httpsHealthCheck = new HttpsHealthCheck();\r\n\t\t// Add your code to populate the httpsHealthCheck object\r\n\t\tCompute.HttpsHealthChecks.Update call = computeService.httpsHealthChecks().update(\"example-project\", \"example-httpsHealthCheck\", httpsHealthCheck);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.httpsHealthChecks.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nhttps_health_check = {} # construct your object here\r\nrequest = service.httpsHealthChecks().update(body=https_health_check, project=\"example-project\", httpsHealthCheck=\"example-httpsHealthCheck\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.httpsHealthChecks.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var httpsHealthCheck = new HttpsHealthCheck();\r\n // Add your code to populate the httpsHealthCheck object\r\n var call = computeService.HttpsHealthChecks.Update(httpsHealthCheck, \"example-project\", \"example-httpsHealthCheck\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.images.delete.snippet.json b/compute.images.delete.snippet.json new file mode 100644 index 0000000..e1b29ad --- /dev/null +++ b/compute.images.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.images.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Images.Delete request = computeService.images().delete(\"example-project\", \"example-image\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.images.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.images().delete(project=\"example-project\", image=\"example-image\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.images.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Images.Delete(\"example-project\", \"example-image\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.images.deprecate.snippet.json b/compute.images.deprecate.snippet.json new file mode 100644 index 0000000..479ab17 --- /dev/null +++ b/compute.images.deprecate.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.images.deprecate\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tDeprecationStatus deprecationStatus = new DeprecationStatus();\r\n\t\t// Add your code to populate the deprecationStatus object\r\n\t\tCompute.Images.Deprecate call = computeService.images().deprecate(\"example-project\", \"example-image\", deprecationStatus);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.images.deprecate\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ndeprecation_status = {} # construct your object here\r\nrequest = service.images().deprecate(body=deprecation_status, project=\"example-project\", image=\"example-image\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.images.deprecate\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var deprecationStatus = new DeprecationStatus();\r\n // Add your code to populate the deprecationStatus object\r\n var call = computeService.Images.Deprecate(deprecationStatus, \"example-project\", \"example-image\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.images.get.snippet.json b/compute.images.get.snippet.json new file mode 100644 index 0000000..9fc9a5b --- /dev/null +++ b/compute.images.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.images.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Images.Get request = computeService.images().get(\"example-project\", \"example-image\");\r\n\t\tImage response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.images.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.images().get(project=\"example-project\", image=\"example-image\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.images.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Images.Get(\"example-project\", \"example-image\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.images.insert.snippet.json b/compute.images.insert.snippet.json new file mode 100644 index 0000000..f0a614f --- /dev/null +++ b/compute.images.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.images.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tImage image = new Image();\r\n\t\t// Add your code to populate the image object\r\n\t\tCompute.Images.Insert call = computeService.images().insert(\"example-project\", image);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.images.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nimage = {} # construct your object here\r\nrequest = service.images().insert(body=image, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.images.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var image = new Image();\r\n // Add your code to populate the image object\r\n var call = computeService.Images.Insert(image, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.images.list.snippet.json b/compute.images.list.snippet.json new file mode 100644 index 0000000..e77628a --- /dev/null +++ b/compute.images.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.images.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tImageList response;\r\n\t\tCompute.Images.List request = computeService.images().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Image item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.images.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.images().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.images().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.images.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ImageList response;\r\n var request = computeService.Images.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroupManagers.abandonInstances.snippet.json b/compute.instanceGroupManagers.abandonInstances.snippet.json new file mode 100644 index 0000000..0e4ddff --- /dev/null +++ b/compute.instanceGroupManagers.abandonInstances.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroupManagers.abandonInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequest = new InstanceGroupManagersAbandonInstancesRequest();\r\n\t\t// Add your code to populate the instanceGroupManagersAbandonInstancesRequest object\r\n\t\tCompute.InstanceGroupManagers.AbandonInstances call = computeService.instanceGroupManagers().abandonInstances(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\", instanceGroupManagersAbandonInstancesRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroupManagers.abandonInstances\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ninstance_group_managers_abandon_instances_request = {} # construct your object here\r\nrequest = service.instanceGroupManagers().abandonInstances(body=instance_group_managers_abandon_instances_request, project=\"example-project\", zone=\"us-central1-a\", instanceGroupManager=\"example-instanceGroupManager\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroupManagers.abandonInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceGroupManagersAbandonInstancesRequest = new InstanceGroupManagersAbandonInstancesRequest();\r\n // Add your code to populate the instanceGroupManagersAbandonInstancesRequest object\r\n var call = computeService.InstanceGroupManagers.AbandonInstances(instanceGroupManagersAbandonInstancesRequest, \"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroupManagers.aggregatedList.snippet.json b/compute.instanceGroupManagers.aggregatedList.snippet.json new file mode 100644 index 0000000..9f34c13 --- /dev/null +++ b/compute.instanceGroupManagers.aggregatedList.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroupManagers.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceGroupManagerAggregatedList response;\r\n\t\tCompute.InstanceGroupManagers.AggregatedList request = computeService.instanceGroupManagers().aggregatedList(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems().values() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (InstanceGroupManagersScopedList item : response.getItems().values()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroupManagers.aggregatedList\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.instanceGroupManagers().aggregatedList(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.instanceGroupManagers().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroupManagers.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n InstanceGroupManagerAggregatedList response;\r\n var request = computeService.InstanceGroupManagers.AggregatedList(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items.Values == null)\r\n continue;\r\n\r\n foreach (var item in response.Items.Values)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroupManagers.delete.snippet.json b/compute.instanceGroupManagers.delete.snippet.json new file mode 100644 index 0000000..466666d --- /dev/null +++ b/compute.instanceGroupManagers.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroupManagers.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.InstanceGroupManagers.Delete request = computeService.instanceGroupManagers().delete(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroupManagers.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.instanceGroupManagers().delete(project=\"example-project\", zone=\"us-central1-a\", instanceGroupManager=\"example-instanceGroupManager\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroupManagers.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.InstanceGroupManagers.Delete(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroupManagers.deleteInstances.snippet.json b/compute.instanceGroupManagers.deleteInstances.snippet.json new file mode 100644 index 0000000..f5007e5 --- /dev/null +++ b/compute.instanceGroupManagers.deleteInstances.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroupManagers.deleteInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceGroupManagersDeleteInstancesRequest instanceGroupManagersDeleteInstancesRequest = new InstanceGroupManagersDeleteInstancesRequest();\r\n\t\t// Add your code to populate the instanceGroupManagersDeleteInstancesRequest object\r\n\t\tCompute.InstanceGroupManagers.DeleteInstances call = computeService.instanceGroupManagers().deleteInstances(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\", instanceGroupManagersDeleteInstancesRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroupManagers.deleteInstances\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ninstance_group_managers_delete_instances_request = {} # construct your object here\r\nrequest = service.instanceGroupManagers().deleteInstances(body=instance_group_managers_delete_instances_request, project=\"example-project\", zone=\"us-central1-a\", instanceGroupManager=\"example-instanceGroupManager\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroupManagers.deleteInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceGroupManagersDeleteInstancesRequest = new InstanceGroupManagersDeleteInstancesRequest();\r\n // Add your code to populate the instanceGroupManagersDeleteInstancesRequest object\r\n var call = computeService.InstanceGroupManagers.DeleteInstances(instanceGroupManagersDeleteInstancesRequest, \"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroupManagers.get.snippet.json b/compute.instanceGroupManagers.get.snippet.json new file mode 100644 index 0000000..ba1f207 --- /dev/null +++ b/compute.instanceGroupManagers.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroupManagers.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.InstanceGroupManagers.Get request = computeService.instanceGroupManagers().get(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n\t\tInstanceGroupManager response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroupManagers.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.instanceGroupManagers().get(project=\"example-project\", zone=\"us-central1-a\", instanceGroupManager=\"example-instanceGroupManager\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroupManagers.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.InstanceGroupManagers.Get(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroupManagers.insert.snippet.json b/compute.instanceGroupManagers.insert.snippet.json new file mode 100644 index 0000000..023b86c --- /dev/null +++ b/compute.instanceGroupManagers.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroupManagers.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceGroupManager instanceGroupManager = new InstanceGroupManager();\r\n\t\t// Add your code to populate the instanceGroupManager object\r\n\t\tCompute.InstanceGroupManagers.Insert call = computeService.instanceGroupManagers().insert(\"example-project\", \"us-central1-a\", instanceGroupManager);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroupManagers.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ninstance_group_manager = {} # construct your object here\r\nrequest = service.instanceGroupManagers().insert(body=instance_group_manager, project=\"example-project\", zone=\"us-central1-a\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroupManagers.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceGroupManager = new InstanceGroupManager();\r\n // Add your code to populate the instanceGroupManager object\r\n var call = computeService.InstanceGroupManagers.Insert(instanceGroupManager, \"example-project\", \"us-central1-a\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroupManagers.list.snippet.json b/compute.instanceGroupManagers.list.snippet.json new file mode 100644 index 0000000..a5387e9 --- /dev/null +++ b/compute.instanceGroupManagers.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroupManagers.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceGroupManagerList response;\r\n\t\tCompute.InstanceGroupManagers.List request = computeService.instanceGroupManagers().list(\"example-project\", \"us-central1-a\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (InstanceGroupManager item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroupManagers.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.instanceGroupManagers().list(project=\"example-project\", zone=\"us-central1-a\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.instanceGroupManagers().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroupManagers.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n InstanceGroupManagerList response;\r\n var request = computeService.InstanceGroupManagers.List(\"example-project\", \"us-central1-a\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroupManagers.listManagedInstances.snippet.json b/compute.instanceGroupManagers.listManagedInstances.snippet.json new file mode 100644 index 0000000..f732a0e --- /dev/null +++ b/compute.instanceGroupManagers.listManagedInstances.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroupManagers.listManagedInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.InstanceGroupManagers.ListManagedInstances request = computeService.instanceGroupManagers().listManagedInstances(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n\t\tInstanceGroupManagersListManagedInstancesResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroupManagers.listManagedInstances\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.instanceGroupManagers().listManagedInstances(project=\"example-project\", zone=\"us-central1-a\", instanceGroupManager=\"example-instanceGroupManager\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroupManagers.listManagedInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.InstanceGroupManagers.ListManagedInstances(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroupManagers.recreateInstances.snippet.json b/compute.instanceGroupManagers.recreateInstances.snippet.json new file mode 100644 index 0000000..e114b95 --- /dev/null +++ b/compute.instanceGroupManagers.recreateInstances.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroupManagers.recreateInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceGroupManagersRecreateInstancesRequest instanceGroupManagersRecreateInstancesRequest = new InstanceGroupManagersRecreateInstancesRequest();\r\n\t\t// Add your code to populate the instanceGroupManagersRecreateInstancesRequest object\r\n\t\tCompute.InstanceGroupManagers.RecreateInstances call = computeService.instanceGroupManagers().recreateInstances(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\", instanceGroupManagersRecreateInstancesRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroupManagers.recreateInstances\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ninstance_group_managers_recreate_instances_request = {} # construct your object here\r\nrequest = service.instanceGroupManagers().recreateInstances(body=instance_group_managers_recreate_instances_request, project=\"example-project\", zone=\"us-central1-a\", instanceGroupManager=\"example-instanceGroupManager\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroupManagers.recreateInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceGroupManagersRecreateInstancesRequest = new InstanceGroupManagersRecreateInstancesRequest();\r\n // Add your code to populate the instanceGroupManagersRecreateInstancesRequest object\r\n var call = computeService.InstanceGroupManagers.RecreateInstances(instanceGroupManagersRecreateInstancesRequest, \"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroupManagers.resize.snippet.json b/compute.instanceGroupManagers.resize.snippet.json new file mode 100644 index 0000000..7024b94 --- /dev/null +++ b/compute.instanceGroupManagers.resize.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroupManagers.resize\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.InstanceGroupManagers.Resize request = computeService.instanceGroupManagers().resize(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\", size_of_type_integer);\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroupManagers.resize\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.instanceGroupManagers().resize(project=\"example-project\", zone=\"us-central1-a\", instanceGroupManager=\"example-instanceGroupManager\", size=size_of_type_integer).execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroupManagers.resize\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.InstanceGroupManagers.Resize(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\", size_of_type_integer);\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroupManagers.setInstanceTemplate.snippet.json b/compute.instanceGroupManagers.setInstanceTemplate.snippet.json new file mode 100644 index 0000000..56cabff --- /dev/null +++ b/compute.instanceGroupManagers.setInstanceTemplate.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroupManagers.setInstanceTemplate\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceGroupManagersSetInstanceTemplateRequest instanceGroupManagersSetInstanceTemplateRequest = new InstanceGroupManagersSetInstanceTemplateRequest();\r\n\t\t// Add your code to populate the instanceGroupManagersSetInstanceTemplateRequest object\r\n\t\tCompute.InstanceGroupManagers.SetInstanceTemplate call = computeService.instanceGroupManagers().setInstanceTemplate(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\", instanceGroupManagersSetInstanceTemplateRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroupManagers.setInstanceTemplate\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ninstance_group_managers_set_instance_template_request = {} # construct your object here\r\nrequest = service.instanceGroupManagers().setInstanceTemplate(body=instance_group_managers_set_instance_template_request, project=\"example-project\", zone=\"us-central1-a\", instanceGroupManager=\"example-instanceGroupManager\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroupManagers.setInstanceTemplate\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceGroupManagersSetInstanceTemplateRequest = new InstanceGroupManagersSetInstanceTemplateRequest();\r\n // Add your code to populate the instanceGroupManagersSetInstanceTemplateRequest object\r\n var call = computeService.InstanceGroupManagers.SetInstanceTemplate(instanceGroupManagersSetInstanceTemplateRequest, \"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroupManagers.setTargetPools.snippet.json b/compute.instanceGroupManagers.setTargetPools.snippet.json new file mode 100644 index 0000000..8ef29c1 --- /dev/null +++ b/compute.instanceGroupManagers.setTargetPools.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroupManagers.setTargetPools\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceGroupManagersSetTargetPoolsRequest instanceGroupManagersSetTargetPoolsRequest = new InstanceGroupManagersSetTargetPoolsRequest();\r\n\t\t// Add your code to populate the instanceGroupManagersSetTargetPoolsRequest object\r\n\t\tCompute.InstanceGroupManagers.SetTargetPools call = computeService.instanceGroupManagers().setTargetPools(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\", instanceGroupManagersSetTargetPoolsRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroupManagers.setTargetPools\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ninstance_group_managers_set_target_pools_request = {} # construct your object here\r\nrequest = service.instanceGroupManagers().setTargetPools(body=instance_group_managers_set_target_pools_request, project=\"example-project\", zone=\"us-central1-a\", instanceGroupManager=\"example-instanceGroupManager\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroupManagers.setTargetPools\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceGroupManagersSetTargetPoolsRequest = new InstanceGroupManagersSetTargetPoolsRequest();\r\n // Add your code to populate the instanceGroupManagersSetTargetPoolsRequest object\r\n var call = computeService.InstanceGroupManagers.SetTargetPools(instanceGroupManagersSetTargetPoolsRequest, \"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroups.addInstances.snippet.json b/compute.instanceGroups.addInstances.snippet.json new file mode 100644 index 0000000..d432fd5 --- /dev/null +++ b/compute.instanceGroups.addInstances.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroups.addInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequest = new InstanceGroupsAddInstancesRequest();\r\n\t\t// Add your code to populate the instanceGroupsAddInstancesRequest object\r\n\t\tCompute.InstanceGroups.AddInstances call = computeService.instanceGroups().addInstances(\"example-project\", \"us-central1-a\", \"example-instanceGroup\", instanceGroupsAddInstancesRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroups.addInstances\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ninstance_groups_add_instances_request = {} # construct your object here\r\nrequest = service.instanceGroups().addInstances(body=instance_groups_add_instances_request, project=\"example-project\", zone=\"us-central1-a\", instanceGroup=\"example-instanceGroup\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroups.addInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceGroupsAddInstancesRequest = new InstanceGroupsAddInstancesRequest();\r\n // Add your code to populate the instanceGroupsAddInstancesRequest object\r\n var call = computeService.InstanceGroups.AddInstances(instanceGroupsAddInstancesRequest, \"example-project\", \"us-central1-a\", \"example-instanceGroup\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroups.aggregatedList.snippet.json b/compute.instanceGroups.aggregatedList.snippet.json new file mode 100644 index 0000000..1b342f8 --- /dev/null +++ b/compute.instanceGroups.aggregatedList.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroups.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceGroupAggregatedList response;\r\n\t\tCompute.InstanceGroups.AggregatedList request = computeService.instanceGroups().aggregatedList(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems().values() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (InstanceGroupsScopedList item : response.getItems().values()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroups.aggregatedList\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.instanceGroups().aggregatedList(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.instanceGroups().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroups.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n InstanceGroupAggregatedList response;\r\n var request = computeService.InstanceGroups.AggregatedList(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items.Values == null)\r\n continue;\r\n\r\n foreach (var item in response.Items.Values)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroups.delete.snippet.json b/compute.instanceGroups.delete.snippet.json new file mode 100644 index 0000000..01bc2a9 --- /dev/null +++ b/compute.instanceGroups.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroups.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.InstanceGroups.Delete request = computeService.instanceGroups().delete(\"example-project\", \"us-central1-a\", \"example-instanceGroup\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroups.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.instanceGroups().delete(project=\"example-project\", zone=\"us-central1-a\", instanceGroup=\"example-instanceGroup\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroups.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.InstanceGroups.Delete(\"example-project\", \"us-central1-a\", \"example-instanceGroup\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroups.get.snippet.json b/compute.instanceGroups.get.snippet.json new file mode 100644 index 0000000..07d15f7 --- /dev/null +++ b/compute.instanceGroups.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroups.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.InstanceGroups.Get request = computeService.instanceGroups().get(\"example-project\", \"us-central1-a\", \"example-instanceGroup\");\r\n\t\tInstanceGroup response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroups.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.instanceGroups().get(project=\"example-project\", zone=\"us-central1-a\", instanceGroup=\"example-instanceGroup\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroups.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.InstanceGroups.Get(\"example-project\", \"us-central1-a\", \"example-instanceGroup\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroups.insert.snippet.json b/compute.instanceGroups.insert.snippet.json new file mode 100644 index 0000000..f5a7584 --- /dev/null +++ b/compute.instanceGroups.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroups.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceGroup instanceGroup = new InstanceGroup();\r\n\t\t// Add your code to populate the instanceGroup object\r\n\t\tCompute.InstanceGroups.Insert call = computeService.instanceGroups().insert(\"example-project\", \"us-central1-a\", instanceGroup);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroups.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ninstance_group = {} # construct your object here\r\nrequest = service.instanceGroups().insert(body=instance_group, project=\"example-project\", zone=\"us-central1-a\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroups.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceGroup = new InstanceGroup();\r\n // Add your code to populate the instanceGroup object\r\n var call = computeService.InstanceGroups.Insert(instanceGroup, \"example-project\", \"us-central1-a\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroups.list.snippet.json b/compute.instanceGroups.list.snippet.json new file mode 100644 index 0000000..b12dc89 --- /dev/null +++ b/compute.instanceGroups.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroups.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceGroupList response;\r\n\t\tCompute.InstanceGroups.List request = computeService.instanceGroups().list(\"example-project\", \"us-central1-a\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (InstanceGroup item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroups.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.instanceGroups().list(project=\"example-project\", zone=\"us-central1-a\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.instanceGroups().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroups.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n InstanceGroupList response;\r\n var request = computeService.InstanceGroups.List(\"example-project\", \"us-central1-a\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroups.listInstances.snippet.json b/compute.instanceGroups.listInstances.snippet.json new file mode 100644 index 0000000..3c73c55 --- /dev/null +++ b/compute.instanceGroups.listInstances.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroups.listInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceGroupsListInstances response;\r\n\t\tCompute.InstanceGroups.ListInstances request = computeService.instanceGroups().listInstances(\"example-project\", \"us-central1-a\", \"example-instanceGroup\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (InstanceWithNamedPorts item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroups.listInstances\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.instanceGroups().listInstances(project=\"example-project\", zone=\"us-central1-a\", instanceGroup=\"example-instanceGroup\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.instanceGroups().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroups.listInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n InstanceGroupsListInstances response;\r\n var request = computeService.InstanceGroups.ListInstances(\"example-project\", \"us-central1-a\", \"example-instanceGroup\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroups.removeInstances.snippet.json b/compute.instanceGroups.removeInstances.snippet.json new file mode 100644 index 0000000..b914b26 --- /dev/null +++ b/compute.instanceGroups.removeInstances.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroups.removeInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequest = new InstanceGroupsRemoveInstancesRequest();\r\n\t\t// Add your code to populate the instanceGroupsRemoveInstancesRequest object\r\n\t\tCompute.InstanceGroups.RemoveInstances call = computeService.instanceGroups().removeInstances(\"example-project\", \"us-central1-a\", \"example-instanceGroup\", instanceGroupsRemoveInstancesRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroups.removeInstances\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ninstance_groups_remove_instances_request = {} # construct your object here\r\nrequest = service.instanceGroups().removeInstances(body=instance_groups_remove_instances_request, project=\"example-project\", zone=\"us-central1-a\", instanceGroup=\"example-instanceGroup\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroups.removeInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceGroupsRemoveInstancesRequest = new InstanceGroupsRemoveInstancesRequest();\r\n // Add your code to populate the instanceGroupsRemoveInstancesRequest object\r\n var call = computeService.InstanceGroups.RemoveInstances(instanceGroupsRemoveInstancesRequest, \"example-project\", \"us-central1-a\", \"example-instanceGroup\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceGroups.setNamedPorts.snippet.json b/compute.instanceGroups.setNamedPorts.snippet.json new file mode 100644 index 0000000..e303b7f --- /dev/null +++ b/compute.instanceGroups.setNamedPorts.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceGroups.setNamedPorts\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequest = new InstanceGroupsSetNamedPortsRequest();\r\n\t\t// Add your code to populate the instanceGroupsSetNamedPortsRequest object\r\n\t\tCompute.InstanceGroups.SetNamedPorts call = computeService.instanceGroups().setNamedPorts(\"example-project\", \"us-central1-a\", \"example-instanceGroup\", instanceGroupsSetNamedPortsRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceGroups.setNamedPorts\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ninstance_groups_set_named_ports_request = {} # construct your object here\r\nrequest = service.instanceGroups().setNamedPorts(body=instance_groups_set_named_ports_request, project=\"example-project\", zone=\"us-central1-a\", instanceGroup=\"example-instanceGroup\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceGroups.setNamedPorts\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceGroupsSetNamedPortsRequest = new InstanceGroupsSetNamedPortsRequest();\r\n // Add your code to populate the instanceGroupsSetNamedPortsRequest object\r\n var call = computeService.InstanceGroups.SetNamedPorts(instanceGroupsSetNamedPortsRequest, \"example-project\", \"us-central1-a\", \"example-instanceGroup\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceTemplates.delete.snippet.json b/compute.instanceTemplates.delete.snippet.json new file mode 100644 index 0000000..ff23d8b --- /dev/null +++ b/compute.instanceTemplates.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceTemplates.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.InstanceTemplates.Delete request = computeService.instanceTemplates().delete(\"example-project\", \"example-instanceTemplate\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceTemplates.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.instanceTemplates().delete(project=\"example-project\", instanceTemplate=\"example-instanceTemplate\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceTemplates.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.InstanceTemplates.Delete(\"example-project\", \"example-instanceTemplate\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceTemplates.get.snippet.json b/compute.instanceTemplates.get.snippet.json new file mode 100644 index 0000000..814b621 --- /dev/null +++ b/compute.instanceTemplates.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceTemplates.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.InstanceTemplates.Get request = computeService.instanceTemplates().get(\"example-project\", \"example-instanceTemplate\");\r\n\t\tInstanceTemplate response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceTemplates.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.instanceTemplates().get(project=\"example-project\", instanceTemplate=\"example-instanceTemplate\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceTemplates.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.InstanceTemplates.Get(\"example-project\", \"example-instanceTemplate\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceTemplates.insert.snippet.json b/compute.instanceTemplates.insert.snippet.json new file mode 100644 index 0000000..027bb86 --- /dev/null +++ b/compute.instanceTemplates.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceTemplates.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceTemplate instanceTemplate = new InstanceTemplate();\r\n\t\t// Add your code to populate the instanceTemplate object\r\n\t\tCompute.InstanceTemplates.Insert call = computeService.instanceTemplates().insert(\"example-project\", instanceTemplate);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceTemplates.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ninstance_template = {} # construct your object here\r\nrequest = service.instanceTemplates().insert(body=instance_template, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceTemplates.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceTemplate = new InstanceTemplate();\r\n // Add your code to populate the instanceTemplate object\r\n var call = computeService.InstanceTemplates.Insert(instanceTemplate, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instanceTemplates.list.snippet.json b/compute.instanceTemplates.list.snippet.json new file mode 100644 index 0000000..a0dbe77 --- /dev/null +++ b/compute.instanceTemplates.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instanceTemplates.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceTemplateList response;\r\n\t\tCompute.InstanceTemplates.List request = computeService.instanceTemplates().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (InstanceTemplate item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instanceTemplates.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.instanceTemplates().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.instanceTemplates().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instanceTemplates.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n InstanceTemplateList response;\r\n var request = computeService.InstanceTemplates.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instances.addAccessConfig.snippet.json b/compute.instances.addAccessConfig.snippet.json new file mode 100644 index 0000000..72cf53f --- /dev/null +++ b/compute.instances.addAccessConfig.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instances.addAccessConfig\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tAccessConfig accessConfig = new AccessConfig();\r\n\t\t// Add your code to populate the accessConfig object\r\n\t\tCompute.Instances.AddAccessConfig call = computeService.instances().addAccessConfig(\"example-project\", \"us-central1-a\", \"debian-instance-1\", \"example-networkInterface\", accessConfig);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instances.addAccessConfig\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\naccess_config = {} # construct your object here\r\nrequest = service.instances().addAccessConfig(body=access_config, project=\"example-project\", zone=\"us-central1-a\", instance=\"debian-instance-1\", networkInterface=\"example-networkInterface\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instances.addAccessConfig\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var accessConfig = new AccessConfig();\r\n // Add your code to populate the accessConfig object\r\n var call = computeService.Instances.AddAccessConfig(accessConfig, \"example-project\", \"us-central1-a\", \"debian-instance-1\", \"example-networkInterface\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instances.aggregatedList.snippet.json b/compute.instances.aggregatedList.snippet.json new file mode 100644 index 0000000..2c89597 --- /dev/null +++ b/compute.instances.aggregatedList.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instances.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceAggregatedList response;\r\n\t\tCompute.Instances.AggregatedList request = computeService.instances().aggregatedList(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems().values() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (InstancesScopedList item : response.getItems().values()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instances.aggregatedList\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.instances().aggregatedList(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.instances().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instances.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n InstanceAggregatedList response;\r\n var request = computeService.Instances.AggregatedList(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items.Values == null)\r\n continue;\r\n\r\n foreach (var item in response.Items.Values)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instances.attachDisk.snippet.json b/compute.instances.attachDisk.snippet.json new file mode 100644 index 0000000..d458ce3 --- /dev/null +++ b/compute.instances.attachDisk.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instances.attachDisk\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tAttachedDisk attachedDisk = new AttachedDisk();\r\n\t\t// Add your code to populate the attachedDisk object\r\n\t\tCompute.Instances.AttachDisk call = computeService.instances().attachDisk(\"example-project\", \"us-central1-a\", \"debian-instance-1\", attachedDisk);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instances.attachDisk\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nattached_disk = {} # construct your object here\r\nrequest = service.instances().attachDisk(body=attached_disk, project=\"example-project\", zone=\"us-central1-a\", instance=\"debian-instance-1\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instances.attachDisk\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var attachedDisk = new AttachedDisk();\r\n // Add your code to populate the attachedDisk object\r\n var call = computeService.Instances.AttachDisk(attachedDisk, \"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instances.delete.snippet.json b/compute.instances.delete.snippet.json new file mode 100644 index 0000000..7445cf4 --- /dev/null +++ b/compute.instances.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instances.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Instances.Delete request = computeService.instances().delete(\"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instances.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.instances().delete(project=\"example-project\", zone=\"us-central1-a\", instance=\"debian-instance-1\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instances.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Instances.Delete(\"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instances.deleteAccessConfig.snippet.json b/compute.instances.deleteAccessConfig.snippet.json new file mode 100644 index 0000000..bf60469 --- /dev/null +++ b/compute.instances.deleteAccessConfig.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instances.deleteAccessConfig\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Instances.DeleteAccessConfig request = computeService.instances().deleteAccessConfig(\"example-project\", \"us-central1-a\", \"debian-instance-1\", \"example-accessConfig\", \"example-networkInterface\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instances.deleteAccessConfig\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.instances().deleteAccessConfig(project=\"example-project\", zone=\"us-central1-a\", instance=\"debian-instance-1\", accessConfig=\"example-accessConfig\", networkInterface=\"example-networkInterface\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instances.deleteAccessConfig\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Instances.DeleteAccessConfig(\"example-project\", \"us-central1-a\", \"debian-instance-1\", \"example-accessConfig\", \"example-networkInterface\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instances.detachDisk.snippet.json b/compute.instances.detachDisk.snippet.json new file mode 100644 index 0000000..aac0508 --- /dev/null +++ b/compute.instances.detachDisk.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instances.detachDisk\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Instances.DetachDisk request = computeService.instances().detachDisk(\"example-project\", \"us-central1-a\", \"debian-instance-1\", \"example-deviceName\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instances.detachDisk\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.instances().detachDisk(project=\"example-project\", zone=\"us-central1-a\", instance=\"debian-instance-1\", deviceName=\"example-deviceName\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instances.detachDisk\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Instances.DetachDisk(\"example-project\", \"us-central1-a\", \"debian-instance-1\", \"example-deviceName\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instances.get.snippet.json b/compute.instances.get.snippet.json new file mode 100644 index 0000000..cfbc22b --- /dev/null +++ b/compute.instances.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instances.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Instances.Get request = computeService.instances().get(\"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n\t\tInstance response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instances.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.instances().get(project=\"example-project\", zone=\"us-central1-a\", instance=\"debian-instance-1\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instances.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Instances.Get(\"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instances.getSerialPortOutput.snippet.json b/compute.instances.getSerialPortOutput.snippet.json new file mode 100644 index 0000000..d3e3293 --- /dev/null +++ b/compute.instances.getSerialPortOutput.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instances.getSerialPortOutput\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Instances.GetSerialPortOutput request = computeService.instances().getSerialPortOutput(\"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n\t\tSerialPortOutput response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instances.getSerialPortOutput\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.instances().getSerialPortOutput(project=\"example-project\", zone=\"us-central1-a\", instance=\"debian-instance-1\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instances.getSerialPortOutput\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Instances.GetSerialPortOutput(\"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instances.insert.snippet.json b/compute.instances.insert.snippet.json new file mode 100644 index 0000000..303674d --- /dev/null +++ b/compute.instances.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instances.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstance instance = new Instance();\r\n\t\t// Add your code to populate the instance object\r\n\t\tCompute.Instances.Insert call = computeService.instances().insert(\"example-project\", \"us-central1-a\", instance);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instances.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ninstance = {} # construct your object here\r\nrequest = service.instances().insert(body=instance, project=\"example-project\", zone=\"us-central1-a\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instances.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instance = new Instance();\r\n // Add your code to populate the instance object\r\n var call = computeService.Instances.Insert(instance, \"example-project\", \"us-central1-a\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instances.list.snippet.json b/compute.instances.list.snippet.json new file mode 100644 index 0000000..ac3134e --- /dev/null +++ b/compute.instances.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instances.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceList response;\r\n\t\tCompute.Instances.List request = computeService.instances().list(\"example-project\", \"us-central1-a\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Instance item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instances.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.instances().list(project=\"example-project\", zone=\"us-central1-a\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.instances().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instances.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n InstanceList response;\r\n var request = computeService.Instances.List(\"example-project\", \"us-central1-a\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instances.reset.snippet.json b/compute.instances.reset.snippet.json new file mode 100644 index 0000000..da81a35 --- /dev/null +++ b/compute.instances.reset.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instances.reset\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Instances.Reset request = computeService.instances().reset(\"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instances.reset\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.instances().reset(project=\"example-project\", zone=\"us-central1-a\", instance=\"debian-instance-1\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instances.reset\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Instances.Reset(\"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instances.setDiskAutoDelete.snippet.json b/compute.instances.setDiskAutoDelete.snippet.json new file mode 100644 index 0000000..08310a6 --- /dev/null +++ b/compute.instances.setDiskAutoDelete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instances.setDiskAutoDelete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Instances.SetDiskAutoDelete request = computeService.instances().setDiskAutoDelete(\"example-project\", \"us-central1-a\", \"debian-instance-1\", , \"example-deviceName\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instances.setDiskAutoDelete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.instances().setDiskAutoDelete(project=\"example-project\", zone=\"us-central1-a\", instance=\"debian-instance-1\", autoDelete=, deviceName=\"example-deviceName\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instances.setDiskAutoDelete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Instances.SetDiskAutoDelete(\"example-project\", \"us-central1-a\", \"debian-instance-1\", , \"example-deviceName\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instances.setMachineType.snippet.json b/compute.instances.setMachineType.snippet.json new file mode 100644 index 0000000..e54cd25 --- /dev/null +++ b/compute.instances.setMachineType.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instances.setMachineType\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstancesSetMachineTypeRequest instancesSetMachineTypeRequest = new InstancesSetMachineTypeRequest();\r\n\t\t// Add your code to populate the instancesSetMachineTypeRequest object\r\n\t\tCompute.Instances.SetMachineType call = computeService.instances().setMachineType(\"example-project\", \"us-central1-a\", \"debian-instance-1\", instancesSetMachineTypeRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instances.setMachineType\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ninstances_set_machine_type_request = {} # construct your object here\r\nrequest = service.instances().setMachineType(body=instances_set_machine_type_request, project=\"example-project\", zone=\"us-central1-a\", instance=\"debian-instance-1\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instances.setMachineType\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instancesSetMachineTypeRequest = new InstancesSetMachineTypeRequest();\r\n // Add your code to populate the instancesSetMachineTypeRequest object\r\n var call = computeService.Instances.SetMachineType(instancesSetMachineTypeRequest, \"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instances.setMetadata.snippet.json b/compute.instances.setMetadata.snippet.json new file mode 100644 index 0000000..7f01c68 --- /dev/null +++ b/compute.instances.setMetadata.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instances.setMetadata\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tMetadata metadata = new Metadata();\r\n\t\t// Add your code to populate the metadata object\r\n\t\tCompute.Instances.SetMetadata call = computeService.instances().setMetadata(\"example-project\", \"us-central1-a\", \"debian-instance-1\", metadata);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instances.setMetadata\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nmetadata = {} # construct your object here\r\nrequest = service.instances().setMetadata(body=metadata, project=\"example-project\", zone=\"us-central1-a\", instance=\"debian-instance-1\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instances.setMetadata\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var metadata = new Metadata();\r\n // Add your code to populate the metadata object\r\n var call = computeService.Instances.SetMetadata(metadata, \"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instances.setScheduling.snippet.json b/compute.instances.setScheduling.snippet.json new file mode 100644 index 0000000..bb5cb87 --- /dev/null +++ b/compute.instances.setScheduling.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instances.setScheduling\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tScheduling scheduling = new Scheduling();\r\n\t\t// Add your code to populate the scheduling object\r\n\t\tCompute.Instances.SetScheduling call = computeService.instances().setScheduling(\"example-project\", \"us-central1-a\", \"debian-instance-1\", scheduling);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instances.setScheduling\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nscheduling = {} # construct your object here\r\nrequest = service.instances().setScheduling(body=scheduling, project=\"example-project\", zone=\"us-central1-a\", instance=\"debian-instance-1\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instances.setScheduling\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var scheduling = new Scheduling();\r\n // Add your code to populate the scheduling object\r\n var call = computeService.Instances.SetScheduling(scheduling, \"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instances.setTags.snippet.json b/compute.instances.setTags.snippet.json new file mode 100644 index 0000000..363a6be --- /dev/null +++ b/compute.instances.setTags.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instances.setTags\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTags tags = new Tags();\r\n\t\t// Add your code to populate the tags object\r\n\t\tCompute.Instances.SetTags call = computeService.instances().setTags(\"example-project\", \"us-central1-a\", \"debian-instance-1\", tags);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instances.setTags\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ntags = {} # construct your object here\r\nrequest = service.instances().setTags(body=tags, project=\"example-project\", zone=\"us-central1-a\", instance=\"debian-instance-1\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instances.setTags\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var tags = new Tags();\r\n // Add your code to populate the tags object\r\n var call = computeService.Instances.SetTags(tags, \"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instances.start.snippet.json b/compute.instances.start.snippet.json new file mode 100644 index 0000000..ddab347 --- /dev/null +++ b/compute.instances.start.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instances.start\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Instances.Start request = computeService.instances().start(\"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instances.start\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.instances().start(project=\"example-project\", zone=\"us-central1-a\", instance=\"debian-instance-1\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instances.start\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Instances.Start(\"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.instances.stop.snippet.json b/compute.instances.stop.snippet.json new file mode 100644 index 0000000..f8396cf --- /dev/null +++ b/compute.instances.stop.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.instances.stop\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Instances.Stop request = computeService.instances().stop(\"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.instances.stop\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.instances().stop(project=\"example-project\", zone=\"us-central1-a\", instance=\"debian-instance-1\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.instances.stop\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Instances.Stop(\"example-project\", \"us-central1-a\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.licenses.get.snippet.json b/compute.licenses.get.snippet.json new file mode 100644 index 0000000..6054901 --- /dev/null +++ b/compute.licenses.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.licenses.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Licenses.Get request = computeService.licenses().get(\"example-project\", \"example-license\");\r\n\t\tLicense response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.licenses.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.licenses().get(project=\"example-project\", license=\"example-license\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.licenses.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Licenses.Get(\"example-project\", \"example-license\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.machineTypes.aggregatedList.snippet.json b/compute.machineTypes.aggregatedList.snippet.json new file mode 100644 index 0000000..c52b7ef --- /dev/null +++ b/compute.machineTypes.aggregatedList.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.machineTypes.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tMachineTypeAggregatedList response;\r\n\t\tCompute.MachineTypes.AggregatedList request = computeService.machineTypes().aggregatedList(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems().values() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (MachineTypesScopedList item : response.getItems().values()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.machineTypes.aggregatedList\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.machineTypes().aggregatedList(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.machineTypes().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.machineTypes.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n MachineTypeAggregatedList response;\r\n var request = computeService.MachineTypes.AggregatedList(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items.Values == null)\r\n continue;\r\n\r\n foreach (var item in response.Items.Values)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.machineTypes.get.snippet.json b/compute.machineTypes.get.snippet.json new file mode 100644 index 0000000..958c54e --- /dev/null +++ b/compute.machineTypes.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.machineTypes.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.MachineTypes.Get request = computeService.machineTypes().get(\"example-project\", \"us-central1-a\", \"example-machineType\");\r\n\t\tMachineType response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.machineTypes.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.machineTypes().get(project=\"example-project\", zone=\"us-central1-a\", machineType=\"example-machineType\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.machineTypes.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.MachineTypes.Get(\"example-project\", \"us-central1-a\", \"example-machineType\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.machineTypes.list.snippet.json b/compute.machineTypes.list.snippet.json new file mode 100644 index 0000000..38f383e --- /dev/null +++ b/compute.machineTypes.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.machineTypes.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tMachineTypeList response;\r\n\t\tCompute.MachineTypes.List request = computeService.machineTypes().list(\"example-project\", \"us-central1-a\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (MachineType item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.machineTypes.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.machineTypes().list(project=\"example-project\", zone=\"us-central1-a\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.machineTypes().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.machineTypes.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n MachineTypeList response;\r\n var request = computeService.MachineTypes.List(\"example-project\", \"us-central1-a\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.networks.delete.snippet.json b/compute.networks.delete.snippet.json new file mode 100644 index 0000000..b7d80e1 --- /dev/null +++ b/compute.networks.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.networks.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Networks.Delete request = computeService.networks().delete(\"example-project\", \"example-network\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.networks.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.networks().delete(project=\"example-project\", network=\"example-network\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.networks.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Networks.Delete(\"example-project\", \"example-network\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.networks.get.snippet.json b/compute.networks.get.snippet.json new file mode 100644 index 0000000..8f560bd --- /dev/null +++ b/compute.networks.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.networks.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Networks.Get request = computeService.networks().get(\"example-project\", \"example-network\");\r\n\t\tNetwork response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.networks.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.networks().get(project=\"example-project\", network=\"example-network\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.networks.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Networks.Get(\"example-project\", \"example-network\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.networks.insert.snippet.json b/compute.networks.insert.snippet.json new file mode 100644 index 0000000..04bad86 --- /dev/null +++ b/compute.networks.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.networks.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tNetwork network = new Network();\r\n\t\t// Add your code to populate the network object\r\n\t\tCompute.Networks.Insert call = computeService.networks().insert(\"example-project\", network);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.networks.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nnetwork = {} # construct your object here\r\nrequest = service.networks().insert(body=network, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.networks.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var network = new Network();\r\n // Add your code to populate the network object\r\n var call = computeService.Networks.Insert(network, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.networks.list.snippet.json b/compute.networks.list.snippet.json new file mode 100644 index 0000000..28def7f --- /dev/null +++ b/compute.networks.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.networks.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tNetworkList response;\r\n\t\tCompute.Networks.List request = computeService.networks().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Network item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.networks.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.networks().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.networks().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.networks.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n NetworkList response;\r\n var request = computeService.Networks.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.projects.get.snippet.json b/compute.projects.get.snippet.json new file mode 100644 index 0000000..6f6a2e1 --- /dev/null +++ b/compute.projects.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.projects.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Projects.Get request = computeService.projects().get(\"example-project\");\r\n\t\tProject response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.projects.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.projects().get(project=\"example-project\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.projects.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Projects.Get(\"example-project\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.projects.moveDisk.snippet.json b/compute.projects.moveDisk.snippet.json new file mode 100644 index 0000000..35898ad --- /dev/null +++ b/compute.projects.moveDisk.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.projects.moveDisk\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tDiskMoveRequest diskMoveRequest = new DiskMoveRequest();\r\n\t\t// Add your code to populate the diskMoveRequest object\r\n\t\tCompute.Projects.MoveDisk call = computeService.projects().moveDisk(\"example-project\", diskMoveRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.projects.moveDisk\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ndisk_move_request = {} # construct your object here\r\nrequest = service.projects().moveDisk(body=disk_move_request, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.projects.moveDisk\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var diskMoveRequest = new DiskMoveRequest();\r\n // Add your code to populate the diskMoveRequest object\r\n var call = computeService.Projects.MoveDisk(diskMoveRequest, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.projects.moveInstance.snippet.json b/compute.projects.moveInstance.snippet.json new file mode 100644 index 0000000..54de705 --- /dev/null +++ b/compute.projects.moveInstance.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.projects.moveInstance\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceMoveRequest instanceMoveRequest = new InstanceMoveRequest();\r\n\t\t// Add your code to populate the instanceMoveRequest object\r\n\t\tCompute.Projects.MoveInstance call = computeService.projects().moveInstance(\"example-project\", instanceMoveRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.projects.moveInstance\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ninstance_move_request = {} # construct your object here\r\nrequest = service.projects().moveInstance(body=instance_move_request, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.projects.moveInstance\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceMoveRequest = new InstanceMoveRequest();\r\n // Add your code to populate the instanceMoveRequest object\r\n var call = computeService.Projects.MoveInstance(instanceMoveRequest, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.projects.setCommonInstanceMetadata.snippet.json b/compute.projects.setCommonInstanceMetadata.snippet.json new file mode 100644 index 0000000..9ff3af4 --- /dev/null +++ b/compute.projects.setCommonInstanceMetadata.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.projects.setCommonInstanceMetadata\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tMetadata metadata = new Metadata();\r\n\t\t// Add your code to populate the metadata object\r\n\t\tCompute.Projects.SetCommonInstanceMetadata call = computeService.projects().setCommonInstanceMetadata(\"example-project\", metadata);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.projects.setCommonInstanceMetadata\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nmetadata = {} # construct your object here\r\nrequest = service.projects().setCommonInstanceMetadata(body=metadata, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.projects.setCommonInstanceMetadata\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var metadata = new Metadata();\r\n // Add your code to populate the metadata object\r\n var call = computeService.Projects.SetCommonInstanceMetadata(metadata, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.projects.setUsageExportBucket.snippet.json b/compute.projects.setUsageExportBucket.snippet.json new file mode 100644 index 0000000..8957535 --- /dev/null +++ b/compute.projects.setUsageExportBucket.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.projects.setUsageExportBucket\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tUsageExportLocation usageExportLocation = new UsageExportLocation();\r\n\t\t// Add your code to populate the usageExportLocation object\r\n\t\tCompute.Projects.SetUsageExportBucket call = computeService.projects().setUsageExportBucket(\"example-project\", usageExportLocation);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.projects.setUsageExportBucket\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nusage_export_location = {} # construct your object here\r\nrequest = service.projects().setUsageExportBucket(body=usage_export_location, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.projects.setUsageExportBucket\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var usageExportLocation = new UsageExportLocation();\r\n // Add your code to populate the usageExportLocation object\r\n var call = computeService.Projects.SetUsageExportBucket(usageExportLocation, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.regionOperations.delete.snippet.json b/compute.regionOperations.delete.snippet.json new file mode 100644 index 0000000..e47d8dd --- /dev/null +++ b/compute.regionOperations.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.regionOperations.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.RegionOperations.Delete request = computeService.regionOperations().delete(\"example-project\", \"example-region\", \"example-operation\");\r\n\t\t response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.regionOperations.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.regionOperations().delete(project=\"example-project\", region=\"example-region\", operation=\"example-operation\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.regionOperations.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.RegionOperations.Delete(\"example-project\", \"example-region\", \"example-operation\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.regionOperations.get.snippet.json b/compute.regionOperations.get.snippet.json new file mode 100644 index 0000000..21cdec0 --- /dev/null +++ b/compute.regionOperations.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.regionOperations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.RegionOperations.Get request = computeService.regionOperations().get(\"example-project\", \"example-region\", \"example-operation\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.regionOperations.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.regionOperations().get(project=\"example-project\", region=\"example-region\", operation=\"example-operation\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.regionOperations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.RegionOperations.Get(\"example-project\", \"example-region\", \"example-operation\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.regionOperations.list.snippet.json b/compute.regionOperations.list.snippet.json new file mode 100644 index 0000000..d47ac8b --- /dev/null +++ b/compute.regionOperations.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.regionOperations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tOperationList response;\r\n\t\tCompute.RegionOperations.List request = computeService.regionOperations().list(\"example-project\", \"example-region\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Operation item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.regionOperations.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.regionOperations().list(project=\"example-project\", region=\"example-region\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.regionOperations().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.regionOperations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n OperationList response;\r\n var request = computeService.RegionOperations.List(\"example-project\", \"example-region\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.regions.get.snippet.json b/compute.regions.get.snippet.json new file mode 100644 index 0000000..ba44aff --- /dev/null +++ b/compute.regions.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.regions.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Regions.Get request = computeService.regions().get(\"example-project\", \"example-region\");\r\n\t\tRegion response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.regions.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.regions().get(project=\"example-project\", region=\"example-region\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.regions.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Regions.Get(\"example-project\", \"example-region\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.regions.list.snippet.json b/compute.regions.list.snippet.json new file mode 100644 index 0000000..25b388b --- /dev/null +++ b/compute.regions.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.regions.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tRegionList response;\r\n\t\tCompute.Regions.List request = computeService.regions().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Region item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.regions.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.regions().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.regions().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.regions.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n RegionList response;\r\n var request = computeService.Regions.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.routes.delete.snippet.json b/compute.routes.delete.snippet.json new file mode 100644 index 0000000..046b39a --- /dev/null +++ b/compute.routes.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.routes.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Routes.Delete request = computeService.routes().delete(\"example-project\", \"example-route\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.routes.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.routes().delete(project=\"example-project\", route=\"example-route\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.routes.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Routes.Delete(\"example-project\", \"example-route\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.routes.get.snippet.json b/compute.routes.get.snippet.json new file mode 100644 index 0000000..a0e69ab --- /dev/null +++ b/compute.routes.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.routes.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Routes.Get request = computeService.routes().get(\"example-project\", \"example-route\");\r\n\t\tRoute response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.routes.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.routes().get(project=\"example-project\", route=\"example-route\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.routes.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Routes.Get(\"example-project\", \"example-route\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.routes.insert.snippet.json b/compute.routes.insert.snippet.json new file mode 100644 index 0000000..a05544f --- /dev/null +++ b/compute.routes.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.routes.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tRoute route = new Route();\r\n\t\t// Add your code to populate the route object\r\n\t\tCompute.Routes.Insert call = computeService.routes().insert(\"example-project\", route);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.routes.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nroute = {} # construct your object here\r\nrequest = service.routes().insert(body=route, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.routes.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var route = new Route();\r\n // Add your code to populate the route object\r\n var call = computeService.Routes.Insert(route, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.routes.list.snippet.json b/compute.routes.list.snippet.json new file mode 100644 index 0000000..db26af4 --- /dev/null +++ b/compute.routes.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.routes.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tRouteList response;\r\n\t\tCompute.Routes.List request = computeService.routes().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Route item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.routes.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.routes().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.routes().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.routes.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n RouteList response;\r\n var request = computeService.Routes.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.snapshots.delete.snippet.json b/compute.snapshots.delete.snippet.json new file mode 100644 index 0000000..187f0f1 --- /dev/null +++ b/compute.snapshots.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.snapshots.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Snapshots.Delete request = computeService.snapshots().delete(\"example-project\", \"example-snapshot\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.snapshots.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.snapshots().delete(project=\"example-project\", snapshot=\"example-snapshot\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.snapshots.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Snapshots.Delete(\"example-project\", \"example-snapshot\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.snapshots.get.snippet.json b/compute.snapshots.get.snippet.json new file mode 100644 index 0000000..2d16f91 --- /dev/null +++ b/compute.snapshots.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.snapshots.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Snapshots.Get request = computeService.snapshots().get(\"example-project\", \"example-snapshot\");\r\n\t\tSnapshot response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.snapshots.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.snapshots().get(project=\"example-project\", snapshot=\"example-snapshot\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.snapshots.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Snapshots.Get(\"example-project\", \"example-snapshot\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.snapshots.list.snippet.json b/compute.snapshots.list.snippet.json new file mode 100644 index 0000000..8101aa2 --- /dev/null +++ b/compute.snapshots.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.snapshots.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tSnapshotList response;\r\n\t\tCompute.Snapshots.List request = computeService.snapshots().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Snapshot item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.snapshots.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.snapshots().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.snapshots().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.snapshots.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n SnapshotList response;\r\n var request = computeService.Snapshots.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.sslCertificates.delete.snippet.json b/compute.sslCertificates.delete.snippet.json new file mode 100644 index 0000000..79131ce --- /dev/null +++ b/compute.sslCertificates.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.sslCertificates.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.SslCertificates.Delete request = computeService.sslCertificates().delete(\"example-project\", \"example-sslCertificate\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.sslCertificates.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.sslCertificates().delete(project=\"example-project\", sslCertificate=\"example-sslCertificate\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.sslCertificates.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.SslCertificates.Delete(\"example-project\", \"example-sslCertificate\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.sslCertificates.get.snippet.json b/compute.sslCertificates.get.snippet.json new file mode 100644 index 0000000..adc9570 --- /dev/null +++ b/compute.sslCertificates.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.sslCertificates.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.SslCertificates.Get request = computeService.sslCertificates().get(\"example-project\", \"example-sslCertificate\");\r\n\t\tSslCertificate response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.sslCertificates.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.sslCertificates().get(project=\"example-project\", sslCertificate=\"example-sslCertificate\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.sslCertificates.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.SslCertificates.Get(\"example-project\", \"example-sslCertificate\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.sslCertificates.insert.snippet.json b/compute.sslCertificates.insert.snippet.json new file mode 100644 index 0000000..b9a04d0 --- /dev/null +++ b/compute.sslCertificates.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.sslCertificates.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tSslCertificate sslCertificate = new SslCertificate();\r\n\t\t// Add your code to populate the sslCertificate object\r\n\t\tCompute.SslCertificates.Insert call = computeService.sslCertificates().insert(\"example-project\", sslCertificate);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.sslCertificates.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nssl_certificate = {} # construct your object here\r\nrequest = service.sslCertificates().insert(body=ssl_certificate, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.sslCertificates.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var sslCertificate = new SslCertificate();\r\n // Add your code to populate the sslCertificate object\r\n var call = computeService.SslCertificates.Insert(sslCertificate, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.sslCertificates.list.snippet.json b/compute.sslCertificates.list.snippet.json new file mode 100644 index 0000000..ee2dfe0 --- /dev/null +++ b/compute.sslCertificates.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.sslCertificates.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tSslCertificateList response;\r\n\t\tCompute.SslCertificates.List request = computeService.sslCertificates().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (SslCertificate item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.sslCertificates.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.sslCertificates().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.sslCertificates().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.sslCertificates.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n SslCertificateList response;\r\n var request = computeService.SslCertificates.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.subnetworks.aggregatedList.snippet.json b/compute.subnetworks.aggregatedList.snippet.json new file mode 100644 index 0000000..11114ed --- /dev/null +++ b/compute.subnetworks.aggregatedList.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.subnetworks.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tSubnetworkAggregatedList response;\r\n\t\tCompute.Subnetworks.AggregatedList request = computeService.subnetworks().aggregatedList(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems().values() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (SubnetworksScopedList item : response.getItems().values()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.subnetworks.aggregatedList\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.subnetworks().aggregatedList(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.subnetworks().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.subnetworks.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n SubnetworkAggregatedList response;\r\n var request = computeService.Subnetworks.AggregatedList(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items.Values == null)\r\n continue;\r\n\r\n foreach (var item in response.Items.Values)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.subnetworks.delete.snippet.json b/compute.subnetworks.delete.snippet.json new file mode 100644 index 0000000..70a7377 --- /dev/null +++ b/compute.subnetworks.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.subnetworks.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Subnetworks.Delete request = computeService.subnetworks().delete(\"example-project\", \"example-region\", \"example-subnetwork\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.subnetworks.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.subnetworks().delete(project=\"example-project\", region=\"example-region\", subnetwork=\"example-subnetwork\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.subnetworks.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Subnetworks.Delete(\"example-project\", \"example-region\", \"example-subnetwork\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.subnetworks.get.snippet.json b/compute.subnetworks.get.snippet.json new file mode 100644 index 0000000..2d845b1 --- /dev/null +++ b/compute.subnetworks.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.subnetworks.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Subnetworks.Get request = computeService.subnetworks().get(\"example-project\", \"example-region\", \"example-subnetwork\");\r\n\t\tSubnetwork response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.subnetworks.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.subnetworks().get(project=\"example-project\", region=\"example-region\", subnetwork=\"example-subnetwork\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.subnetworks.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Subnetworks.Get(\"example-project\", \"example-region\", \"example-subnetwork\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.subnetworks.insert.snippet.json b/compute.subnetworks.insert.snippet.json new file mode 100644 index 0000000..9eaee8c --- /dev/null +++ b/compute.subnetworks.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.subnetworks.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tSubnetwork subnetwork = new Subnetwork();\r\n\t\t// Add your code to populate the subnetwork object\r\n\t\tCompute.Subnetworks.Insert call = computeService.subnetworks().insert(\"example-project\", \"example-region\", subnetwork);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.subnetworks.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nsubnetwork = {} # construct your object here\r\nrequest = service.subnetworks().insert(body=subnetwork, project=\"example-project\", region=\"example-region\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.subnetworks.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var subnetwork = new Subnetwork();\r\n // Add your code to populate the subnetwork object\r\n var call = computeService.Subnetworks.Insert(subnetwork, \"example-project\", \"example-region\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.subnetworks.list.snippet.json b/compute.subnetworks.list.snippet.json new file mode 100644 index 0000000..a4789d4 --- /dev/null +++ b/compute.subnetworks.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.subnetworks.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tSubnetworkList response;\r\n\t\tCompute.Subnetworks.List request = computeService.subnetworks().list(\"example-project\", \"example-region\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Subnetwork item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.subnetworks.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.subnetworks().list(project=\"example-project\", region=\"example-region\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.subnetworks().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.subnetworks.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n SubnetworkList response;\r\n var request = computeService.Subnetworks.List(\"example-project\", \"example-region\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetHttpProxies.delete.snippet.json b/compute.targetHttpProxies.delete.snippet.json new file mode 100644 index 0000000..6beb445 --- /dev/null +++ b/compute.targetHttpProxies.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetHttpProxies.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.TargetHttpProxies.Delete request = computeService.targetHttpProxies().delete(\"example-project\", \"example-targetHttpProxy\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetHttpProxies.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.targetHttpProxies().delete(project=\"example-project\", targetHttpProxy=\"example-targetHttpProxy\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetHttpProxies.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.TargetHttpProxies.Delete(\"example-project\", \"example-targetHttpProxy\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetHttpProxies.get.snippet.json b/compute.targetHttpProxies.get.snippet.json new file mode 100644 index 0000000..9690ec3 --- /dev/null +++ b/compute.targetHttpProxies.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetHttpProxies.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.TargetHttpProxies.Get request = computeService.targetHttpProxies().get(\"example-project\", \"example-targetHttpProxy\");\r\n\t\tTargetHttpProxy response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetHttpProxies.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.targetHttpProxies().get(project=\"example-project\", targetHttpProxy=\"example-targetHttpProxy\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetHttpProxies.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.TargetHttpProxies.Get(\"example-project\", \"example-targetHttpProxy\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetHttpProxies.insert.snippet.json b/compute.targetHttpProxies.insert.snippet.json new file mode 100644 index 0000000..1f5ef98 --- /dev/null +++ b/compute.targetHttpProxies.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetHttpProxies.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetHttpProxy targetHttpProxy = new TargetHttpProxy();\r\n\t\t// Add your code to populate the targetHttpProxy object\r\n\t\tCompute.TargetHttpProxies.Insert call = computeService.targetHttpProxies().insert(\"example-project\", targetHttpProxy);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetHttpProxies.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ntarget_http_proxy = {} # construct your object here\r\nrequest = service.targetHttpProxies().insert(body=target_http_proxy, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetHttpProxies.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var targetHttpProxy = new TargetHttpProxy();\r\n // Add your code to populate the targetHttpProxy object\r\n var call = computeService.TargetHttpProxies.Insert(targetHttpProxy, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetHttpProxies.list.snippet.json b/compute.targetHttpProxies.list.snippet.json new file mode 100644 index 0000000..0601b15 --- /dev/null +++ b/compute.targetHttpProxies.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetHttpProxies.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetHttpProxyList response;\r\n\t\tCompute.TargetHttpProxies.List request = computeService.targetHttpProxies().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (TargetHttpProxy item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetHttpProxies.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.targetHttpProxies().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.targetHttpProxies().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetHttpProxies.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n TargetHttpProxyList response;\r\n var request = computeService.TargetHttpProxies.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetHttpProxies.setUrlMap.snippet.json b/compute.targetHttpProxies.setUrlMap.snippet.json new file mode 100644 index 0000000..cc0a6d9 --- /dev/null +++ b/compute.targetHttpProxies.setUrlMap.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetHttpProxies.setUrlMap\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tUrlMapReference urlMapReference = new UrlMapReference();\r\n\t\t// Add your code to populate the urlMapReference object\r\n\t\tCompute.TargetHttpProxies.SetUrlMap call = computeService.targetHttpProxies().setUrlMap(\"example-project\", \"example-targetHttpProxy\", urlMapReference);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetHttpProxies.setUrlMap\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nurl_map_reference = {} # construct your object here\r\nrequest = service.targetHttpProxies().setUrlMap(body=url_map_reference, project=\"example-project\", targetHttpProxy=\"example-targetHttpProxy\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetHttpProxies.setUrlMap\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var urlMapReference = new UrlMapReference();\r\n // Add your code to populate the urlMapReference object\r\n var call = computeService.TargetHttpProxies.SetUrlMap(urlMapReference, \"example-project\", \"example-targetHttpProxy\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetHttpsProxies.delete.snippet.json b/compute.targetHttpsProxies.delete.snippet.json new file mode 100644 index 0000000..3844d8d --- /dev/null +++ b/compute.targetHttpsProxies.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetHttpsProxies.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.TargetHttpsProxies.Delete request = computeService.targetHttpsProxies().delete(\"example-project\", \"example-targetHttpsProxy\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetHttpsProxies.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.targetHttpsProxies().delete(project=\"example-project\", targetHttpsProxy=\"example-targetHttpsProxy\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetHttpsProxies.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.TargetHttpsProxies.Delete(\"example-project\", \"example-targetHttpsProxy\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetHttpsProxies.get.snippet.json b/compute.targetHttpsProxies.get.snippet.json new file mode 100644 index 0000000..d068721 --- /dev/null +++ b/compute.targetHttpsProxies.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetHttpsProxies.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.TargetHttpsProxies.Get request = computeService.targetHttpsProxies().get(\"example-project\", \"example-targetHttpsProxy\");\r\n\t\tTargetHttpsProxy response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetHttpsProxies.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.targetHttpsProxies().get(project=\"example-project\", targetHttpsProxy=\"example-targetHttpsProxy\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetHttpsProxies.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.TargetHttpsProxies.Get(\"example-project\", \"example-targetHttpsProxy\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetHttpsProxies.insert.snippet.json b/compute.targetHttpsProxies.insert.snippet.json new file mode 100644 index 0000000..f12ba65 --- /dev/null +++ b/compute.targetHttpsProxies.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetHttpsProxies.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetHttpsProxy targetHttpsProxy = new TargetHttpsProxy();\r\n\t\t// Add your code to populate the targetHttpsProxy object\r\n\t\tCompute.TargetHttpsProxies.Insert call = computeService.targetHttpsProxies().insert(\"example-project\", targetHttpsProxy);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetHttpsProxies.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ntarget_https_proxy = {} # construct your object here\r\nrequest = service.targetHttpsProxies().insert(body=target_https_proxy, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetHttpsProxies.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var targetHttpsProxy = new TargetHttpsProxy();\r\n // Add your code to populate the targetHttpsProxy object\r\n var call = computeService.TargetHttpsProxies.Insert(targetHttpsProxy, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetHttpsProxies.list.snippet.json b/compute.targetHttpsProxies.list.snippet.json new file mode 100644 index 0000000..9781cd0 --- /dev/null +++ b/compute.targetHttpsProxies.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetHttpsProxies.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetHttpsProxyList response;\r\n\t\tCompute.TargetHttpsProxies.List request = computeService.targetHttpsProxies().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (TargetHttpsProxy item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetHttpsProxies.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.targetHttpsProxies().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.targetHttpsProxies().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetHttpsProxies.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n TargetHttpsProxyList response;\r\n var request = computeService.TargetHttpsProxies.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetHttpsProxies.setSslCertificates.snippet.json b/compute.targetHttpsProxies.setSslCertificates.snippet.json new file mode 100644 index 0000000..d9e5e52 --- /dev/null +++ b/compute.targetHttpsProxies.setSslCertificates.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetHttpsProxies.setSslCertificates\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetHttpsProxiesSetSslCertificatesRequest targetHttpsProxiesSetSslCertificatesRequest = new TargetHttpsProxiesSetSslCertificatesRequest();\r\n\t\t// Add your code to populate the targetHttpsProxiesSetSslCertificatesRequest object\r\n\t\tCompute.TargetHttpsProxies.SetSslCertificates call = computeService.targetHttpsProxies().setSslCertificates(\"example-project\", \"example-targetHttpsProxy\", targetHttpsProxiesSetSslCertificatesRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetHttpsProxies.setSslCertificates\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ntarget_https_proxies_set_ssl_certificates_request = {} # construct your object here\r\nrequest = service.targetHttpsProxies().setSslCertificates(body=target_https_proxies_set_ssl_certificates_request, project=\"example-project\", targetHttpsProxy=\"example-targetHttpsProxy\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetHttpsProxies.setSslCertificates\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var targetHttpsProxiesSetSslCertificatesRequest = new TargetHttpsProxiesSetSslCertificatesRequest();\r\n // Add your code to populate the targetHttpsProxiesSetSslCertificatesRequest object\r\n var call = computeService.TargetHttpsProxies.SetSslCertificates(targetHttpsProxiesSetSslCertificatesRequest, \"example-project\", \"example-targetHttpsProxy\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetHttpsProxies.setUrlMap.snippet.json b/compute.targetHttpsProxies.setUrlMap.snippet.json new file mode 100644 index 0000000..2dc5e1e --- /dev/null +++ b/compute.targetHttpsProxies.setUrlMap.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetHttpsProxies.setUrlMap\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tUrlMapReference urlMapReference = new UrlMapReference();\r\n\t\t// Add your code to populate the urlMapReference object\r\n\t\tCompute.TargetHttpsProxies.SetUrlMap call = computeService.targetHttpsProxies().setUrlMap(\"example-project\", \"example-targetHttpsProxy\", urlMapReference);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetHttpsProxies.setUrlMap\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nurl_map_reference = {} # construct your object here\r\nrequest = service.targetHttpsProxies().setUrlMap(body=url_map_reference, project=\"example-project\", targetHttpsProxy=\"example-targetHttpsProxy\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetHttpsProxies.setUrlMap\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var urlMapReference = new UrlMapReference();\r\n // Add your code to populate the urlMapReference object\r\n var call = computeService.TargetHttpsProxies.SetUrlMap(urlMapReference, \"example-project\", \"example-targetHttpsProxy\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetInstances.aggregatedList.snippet.json b/compute.targetInstances.aggregatedList.snippet.json new file mode 100644 index 0000000..1a49f83 --- /dev/null +++ b/compute.targetInstances.aggregatedList.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetInstances.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetInstanceAggregatedList response;\r\n\t\tCompute.TargetInstances.AggregatedList request = computeService.targetInstances().aggregatedList(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems().values() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (TargetInstancesScopedList item : response.getItems().values()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetInstances.aggregatedList\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.targetInstances().aggregatedList(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.targetInstances().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetInstances.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n TargetInstanceAggregatedList response;\r\n var request = computeService.TargetInstances.AggregatedList(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items.Values == null)\r\n continue;\r\n\r\n foreach (var item in response.Items.Values)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetInstances.delete.snippet.json b/compute.targetInstances.delete.snippet.json new file mode 100644 index 0000000..5f35a45 --- /dev/null +++ b/compute.targetInstances.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetInstances.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.TargetInstances.Delete request = computeService.targetInstances().delete(\"example-project\", \"us-central1-a\", \"example-targetInstance\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetInstances.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.targetInstances().delete(project=\"example-project\", zone=\"us-central1-a\", targetInstance=\"example-targetInstance\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetInstances.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.TargetInstances.Delete(\"example-project\", \"us-central1-a\", \"example-targetInstance\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetInstances.get.snippet.json b/compute.targetInstances.get.snippet.json new file mode 100644 index 0000000..328350b --- /dev/null +++ b/compute.targetInstances.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetInstances.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.TargetInstances.Get request = computeService.targetInstances().get(\"example-project\", \"us-central1-a\", \"example-targetInstance\");\r\n\t\tTargetInstance response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetInstances.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.targetInstances().get(project=\"example-project\", zone=\"us-central1-a\", targetInstance=\"example-targetInstance\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetInstances.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.TargetInstances.Get(\"example-project\", \"us-central1-a\", \"example-targetInstance\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetInstances.insert.snippet.json b/compute.targetInstances.insert.snippet.json new file mode 100644 index 0000000..d667804 --- /dev/null +++ b/compute.targetInstances.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetInstances.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetInstance targetInstance = new TargetInstance();\r\n\t\t// Add your code to populate the targetInstance object\r\n\t\tCompute.TargetInstances.Insert call = computeService.targetInstances().insert(\"example-project\", \"us-central1-a\", targetInstance);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetInstances.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ntarget_instance = {} # construct your object here\r\nrequest = service.targetInstances().insert(body=target_instance, project=\"example-project\", zone=\"us-central1-a\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetInstances.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var targetInstance = new TargetInstance();\r\n // Add your code to populate the targetInstance object\r\n var call = computeService.TargetInstances.Insert(targetInstance, \"example-project\", \"us-central1-a\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetInstances.list.snippet.json b/compute.targetInstances.list.snippet.json new file mode 100644 index 0000000..f60efab --- /dev/null +++ b/compute.targetInstances.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetInstances.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetInstanceList response;\r\n\t\tCompute.TargetInstances.List request = computeService.targetInstances().list(\"example-project\", \"us-central1-a\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (TargetInstance item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetInstances.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.targetInstances().list(project=\"example-project\", zone=\"us-central1-a\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.targetInstances().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetInstances.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n TargetInstanceList response;\r\n var request = computeService.TargetInstances.List(\"example-project\", \"us-central1-a\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetPools.addHealthCheck.snippet.json b/compute.targetPools.addHealthCheck.snippet.json new file mode 100644 index 0000000..f3c1215 --- /dev/null +++ b/compute.targetPools.addHealthCheck.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetPools.addHealthCheck\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequest = new TargetPoolsAddHealthCheckRequest();\r\n\t\t// Add your code to populate the targetPoolsAddHealthCheckRequest object\r\n\t\tCompute.TargetPools.AddHealthCheck call = computeService.targetPools().addHealthCheck(\"example-project\", \"example-region\", \"example-targetPool\", targetPoolsAddHealthCheckRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetPools.addHealthCheck\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ntarget_pools_add_health_check_request = {} # construct your object here\r\nrequest = service.targetPools().addHealthCheck(body=target_pools_add_health_check_request, project=\"example-project\", region=\"example-region\", targetPool=\"example-targetPool\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetPools.addHealthCheck\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var targetPoolsAddHealthCheckRequest = new TargetPoolsAddHealthCheckRequest();\r\n // Add your code to populate the targetPoolsAddHealthCheckRequest object\r\n var call = computeService.TargetPools.AddHealthCheck(targetPoolsAddHealthCheckRequest, \"example-project\", \"example-region\", \"example-targetPool\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetPools.addInstance.snippet.json b/compute.targetPools.addInstance.snippet.json new file mode 100644 index 0000000..8a953da --- /dev/null +++ b/compute.targetPools.addInstance.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetPools.addInstance\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetPoolsAddInstanceRequest targetPoolsAddInstanceRequest = new TargetPoolsAddInstanceRequest();\r\n\t\t// Add your code to populate the targetPoolsAddInstanceRequest object\r\n\t\tCompute.TargetPools.AddInstance call = computeService.targetPools().addInstance(\"example-project\", \"example-region\", \"example-targetPool\", targetPoolsAddInstanceRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetPools.addInstance\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ntarget_pools_add_instance_request = {} # construct your object here\r\nrequest = service.targetPools().addInstance(body=target_pools_add_instance_request, project=\"example-project\", region=\"example-region\", targetPool=\"example-targetPool\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetPools.addInstance\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var targetPoolsAddInstanceRequest = new TargetPoolsAddInstanceRequest();\r\n // Add your code to populate the targetPoolsAddInstanceRequest object\r\n var call = computeService.TargetPools.AddInstance(targetPoolsAddInstanceRequest, \"example-project\", \"example-region\", \"example-targetPool\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetPools.aggregatedList.snippet.json b/compute.targetPools.aggregatedList.snippet.json new file mode 100644 index 0000000..3085f78 --- /dev/null +++ b/compute.targetPools.aggregatedList.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetPools.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetPoolAggregatedList response;\r\n\t\tCompute.TargetPools.AggregatedList request = computeService.targetPools().aggregatedList(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems().values() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (TargetPoolsScopedList item : response.getItems().values()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetPools.aggregatedList\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.targetPools().aggregatedList(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.targetPools().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetPools.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n TargetPoolAggregatedList response;\r\n var request = computeService.TargetPools.AggregatedList(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items.Values == null)\r\n continue;\r\n\r\n foreach (var item in response.Items.Values)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetPools.delete.snippet.json b/compute.targetPools.delete.snippet.json new file mode 100644 index 0000000..b008f9f --- /dev/null +++ b/compute.targetPools.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetPools.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.TargetPools.Delete request = computeService.targetPools().delete(\"example-project\", \"example-region\", \"example-targetPool\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetPools.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.targetPools().delete(project=\"example-project\", region=\"example-region\", targetPool=\"example-targetPool\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetPools.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.TargetPools.Delete(\"example-project\", \"example-region\", \"example-targetPool\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetPools.get.snippet.json b/compute.targetPools.get.snippet.json new file mode 100644 index 0000000..90e425d --- /dev/null +++ b/compute.targetPools.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetPools.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.TargetPools.Get request = computeService.targetPools().get(\"example-project\", \"example-region\", \"example-targetPool\");\r\n\t\tTargetPool response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetPools.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.targetPools().get(project=\"example-project\", region=\"example-region\", targetPool=\"example-targetPool\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetPools.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.TargetPools.Get(\"example-project\", \"example-region\", \"example-targetPool\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetPools.getHealth.snippet.json b/compute.targetPools.getHealth.snippet.json new file mode 100644 index 0000000..676eed4 --- /dev/null +++ b/compute.targetPools.getHealth.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetPools.getHealth\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tInstanceReference instanceReference = new InstanceReference();\r\n\t\t// Add your code to populate the instanceReference object\r\n\t\tCompute.TargetPools.GetHealth call = computeService.targetPools().getHealth(\"example-project\", \"example-region\", \"example-targetPool\", instanceReference);\r\n\t\tTargetPoolInstanceHealth response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetPools.getHealth\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ninstance_reference = {} # construct your object here\r\nrequest = service.targetPools().getHealth(body=instance_reference, project=\"example-project\", region=\"example-region\", targetPool=\"example-targetPool\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetPools.getHealth\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceReference = new InstanceReference();\r\n // Add your code to populate the instanceReference object\r\n var call = computeService.TargetPools.GetHealth(instanceReference, \"example-project\", \"example-region\", \"example-targetPool\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetPools.insert.snippet.json b/compute.targetPools.insert.snippet.json new file mode 100644 index 0000000..3928a25 --- /dev/null +++ b/compute.targetPools.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetPools.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetPool targetPool = new TargetPool();\r\n\t\t// Add your code to populate the targetPool object\r\n\t\tCompute.TargetPools.Insert call = computeService.targetPools().insert(\"example-project\", \"example-region\", targetPool);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetPools.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ntarget_pool = {} # construct your object here\r\nrequest = service.targetPools().insert(body=target_pool, project=\"example-project\", region=\"example-region\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetPools.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var targetPool = new TargetPool();\r\n // Add your code to populate the targetPool object\r\n var call = computeService.TargetPools.Insert(targetPool, \"example-project\", \"example-region\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetPools.list.snippet.json b/compute.targetPools.list.snippet.json new file mode 100644 index 0000000..f06b976 --- /dev/null +++ b/compute.targetPools.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetPools.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetPoolList response;\r\n\t\tCompute.TargetPools.List request = computeService.targetPools().list(\"example-project\", \"example-region\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (TargetPool item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetPools.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.targetPools().list(project=\"example-project\", region=\"example-region\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.targetPools().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetPools.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n TargetPoolList response;\r\n var request = computeService.TargetPools.List(\"example-project\", \"example-region\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetPools.removeHealthCheck.snippet.json b/compute.targetPools.removeHealthCheck.snippet.json new file mode 100644 index 0000000..814e991 --- /dev/null +++ b/compute.targetPools.removeHealthCheck.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetPools.removeHealthCheck\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequest = new TargetPoolsRemoveHealthCheckRequest();\r\n\t\t// Add your code to populate the targetPoolsRemoveHealthCheckRequest object\r\n\t\tCompute.TargetPools.RemoveHealthCheck call = computeService.targetPools().removeHealthCheck(\"example-project\", \"example-region\", \"example-targetPool\", targetPoolsRemoveHealthCheckRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetPools.removeHealthCheck\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ntarget_pools_remove_health_check_request = {} # construct your object here\r\nrequest = service.targetPools().removeHealthCheck(body=target_pools_remove_health_check_request, project=\"example-project\", region=\"example-region\", targetPool=\"example-targetPool\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetPools.removeHealthCheck\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var targetPoolsRemoveHealthCheckRequest = new TargetPoolsRemoveHealthCheckRequest();\r\n // Add your code to populate the targetPoolsRemoveHealthCheckRequest object\r\n var call = computeService.TargetPools.RemoveHealthCheck(targetPoolsRemoveHealthCheckRequest, \"example-project\", \"example-region\", \"example-targetPool\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetPools.removeInstance.snippet.json b/compute.targetPools.removeInstance.snippet.json new file mode 100644 index 0000000..093490e --- /dev/null +++ b/compute.targetPools.removeInstance.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetPools.removeInstance\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequest = new TargetPoolsRemoveInstanceRequest();\r\n\t\t// Add your code to populate the targetPoolsRemoveInstanceRequest object\r\n\t\tCompute.TargetPools.RemoveInstance call = computeService.targetPools().removeInstance(\"example-project\", \"example-region\", \"example-targetPool\", targetPoolsRemoveInstanceRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetPools.removeInstance\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ntarget_pools_remove_instance_request = {} # construct your object here\r\nrequest = service.targetPools().removeInstance(body=target_pools_remove_instance_request, project=\"example-project\", region=\"example-region\", targetPool=\"example-targetPool\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetPools.removeInstance\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var targetPoolsRemoveInstanceRequest = new TargetPoolsRemoveInstanceRequest();\r\n // Add your code to populate the targetPoolsRemoveInstanceRequest object\r\n var call = computeService.TargetPools.RemoveInstance(targetPoolsRemoveInstanceRequest, \"example-project\", \"example-region\", \"example-targetPool\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetPools.setBackup.snippet.json b/compute.targetPools.setBackup.snippet.json new file mode 100644 index 0000000..3f5577e --- /dev/null +++ b/compute.targetPools.setBackup.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetPools.setBackup\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetReference targetReference = new TargetReference();\r\n\t\t// Add your code to populate the targetReference object\r\n\t\tCompute.TargetPools.SetBackup call = computeService.targetPools().setBackup(\"example-project\", \"example-region\", \"example-targetPool\", targetReference);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetPools.setBackup\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ntarget_reference = {} # construct your object here\r\nrequest = service.targetPools().setBackup(body=target_reference, project=\"example-project\", region=\"example-region\", targetPool=\"example-targetPool\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetPools.setBackup\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var targetReference = new TargetReference();\r\n // Add your code to populate the targetReference object\r\n var call = computeService.TargetPools.SetBackup(targetReference, \"example-project\", \"example-region\", \"example-targetPool\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetVpnGateways.aggregatedList.snippet.json b/compute.targetVpnGateways.aggregatedList.snippet.json new file mode 100644 index 0000000..e51dcea --- /dev/null +++ b/compute.targetVpnGateways.aggregatedList.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetVpnGateways.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetVpnGatewayAggregatedList response;\r\n\t\tCompute.TargetVpnGateways.AggregatedList request = computeService.targetVpnGateways().aggregatedList(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems().values() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (TargetVpnGatewaysScopedList item : response.getItems().values()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetVpnGateways.aggregatedList\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.targetVpnGateways().aggregatedList(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.targetVpnGateways().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetVpnGateways.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n TargetVpnGatewayAggregatedList response;\r\n var request = computeService.TargetVpnGateways.AggregatedList(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items.Values == null)\r\n continue;\r\n\r\n foreach (var item in response.Items.Values)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetVpnGateways.delete.snippet.json b/compute.targetVpnGateways.delete.snippet.json new file mode 100644 index 0000000..5442d16 --- /dev/null +++ b/compute.targetVpnGateways.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetVpnGateways.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.TargetVpnGateways.Delete request = computeService.targetVpnGateways().delete(\"example-project\", \"example-region\", \"example-targetVpnGateway\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetVpnGateways.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.targetVpnGateways().delete(project=\"example-project\", region=\"example-region\", targetVpnGateway=\"example-targetVpnGateway\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetVpnGateways.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.TargetVpnGateways.Delete(\"example-project\", \"example-region\", \"example-targetVpnGateway\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetVpnGateways.get.snippet.json b/compute.targetVpnGateways.get.snippet.json new file mode 100644 index 0000000..47e4549 --- /dev/null +++ b/compute.targetVpnGateways.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetVpnGateways.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.TargetVpnGateways.Get request = computeService.targetVpnGateways().get(\"example-project\", \"example-region\", \"example-targetVpnGateway\");\r\n\t\tTargetVpnGateway response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetVpnGateways.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.targetVpnGateways().get(project=\"example-project\", region=\"example-region\", targetVpnGateway=\"example-targetVpnGateway\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetVpnGateways.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.TargetVpnGateways.Get(\"example-project\", \"example-region\", \"example-targetVpnGateway\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetVpnGateways.insert.snippet.json b/compute.targetVpnGateways.insert.snippet.json new file mode 100644 index 0000000..5d86d15 --- /dev/null +++ b/compute.targetVpnGateways.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetVpnGateways.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetVpnGateway targetVpnGateway = new TargetVpnGateway();\r\n\t\t// Add your code to populate the targetVpnGateway object\r\n\t\tCompute.TargetVpnGateways.Insert call = computeService.targetVpnGateways().insert(\"example-project\", \"example-region\", targetVpnGateway);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetVpnGateways.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\ntarget_vpn_gateway = {} # construct your object here\r\nrequest = service.targetVpnGateways().insert(body=target_vpn_gateway, project=\"example-project\", region=\"example-region\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetVpnGateways.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var targetVpnGateway = new TargetVpnGateway();\r\n // Add your code to populate the targetVpnGateway object\r\n var call = computeService.TargetVpnGateways.Insert(targetVpnGateway, \"example-project\", \"example-region\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.targetVpnGateways.list.snippet.json b/compute.targetVpnGateways.list.snippet.json new file mode 100644 index 0000000..b5b6d6c --- /dev/null +++ b/compute.targetVpnGateways.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.targetVpnGateways.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tTargetVpnGatewayList response;\r\n\t\tCompute.TargetVpnGateways.List request = computeService.targetVpnGateways().list(\"example-project\", \"example-region\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (TargetVpnGateway item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.targetVpnGateways.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.targetVpnGateways().list(project=\"example-project\", region=\"example-region\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.targetVpnGateways().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.targetVpnGateways.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n TargetVpnGatewayList response;\r\n var request = computeService.TargetVpnGateways.List(\"example-project\", \"example-region\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.urlMaps.delete.snippet.json b/compute.urlMaps.delete.snippet.json new file mode 100644 index 0000000..61fcc23 --- /dev/null +++ b/compute.urlMaps.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.urlMaps.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.UrlMaps.Delete request = computeService.urlMaps().delete(\"example-project\", \"example-urlMap\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.urlMaps.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.urlMaps().delete(project=\"example-project\", urlMap=\"example-urlMap\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.urlMaps.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.UrlMaps.Delete(\"example-project\", \"example-urlMap\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.urlMaps.get.snippet.json b/compute.urlMaps.get.snippet.json new file mode 100644 index 0000000..a852528 --- /dev/null +++ b/compute.urlMaps.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.urlMaps.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.UrlMaps.Get request = computeService.urlMaps().get(\"example-project\", \"example-urlMap\");\r\n\t\tUrlMap response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.urlMaps.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.urlMaps().get(project=\"example-project\", urlMap=\"example-urlMap\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.urlMaps.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.UrlMaps.Get(\"example-project\", \"example-urlMap\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.urlMaps.insert.snippet.json b/compute.urlMaps.insert.snippet.json new file mode 100644 index 0000000..583c334 --- /dev/null +++ b/compute.urlMaps.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.urlMaps.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tUrlMap urlMap = new UrlMap();\r\n\t\t// Add your code to populate the urlMap object\r\n\t\tCompute.UrlMaps.Insert call = computeService.urlMaps().insert(\"example-project\", urlMap);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.urlMaps.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nurl_map = {} # construct your object here\r\nrequest = service.urlMaps().insert(body=url_map, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.urlMaps.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var urlMap = new UrlMap();\r\n // Add your code to populate the urlMap object\r\n var call = computeService.UrlMaps.Insert(urlMap, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.urlMaps.list.snippet.json b/compute.urlMaps.list.snippet.json new file mode 100644 index 0000000..986d987 --- /dev/null +++ b/compute.urlMaps.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.urlMaps.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tUrlMapList response;\r\n\t\tCompute.UrlMaps.List request = computeService.urlMaps().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (UrlMap item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.urlMaps.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.urlMaps().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.urlMaps().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.urlMaps.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n UrlMapList response;\r\n var request = computeService.UrlMaps.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.urlMaps.patch.snippet.json b/compute.urlMaps.patch.snippet.json new file mode 100644 index 0000000..30ded68 --- /dev/null +++ b/compute.urlMaps.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.urlMaps.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\t// Obtain the UrlMap object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tCompute.UrlMaps.Patch request = computeService.urlMaps().patch(\"example-project\", \"example-urlMap\", urlMap);\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.urlMaps.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\n# Obtain the url_map object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.urlMaps().patch(body=url_map, project=\"example-project\", urlMap=\"example-urlMap\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.urlMaps.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the UrlMap object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = computeService.UrlMaps.Patch(urlMap, \"example-project\", \"example-urlMap\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.urlMaps.update.snippet.json b/compute.urlMaps.update.snippet.json new file mode 100644 index 0000000..dff64aa --- /dev/null +++ b/compute.urlMaps.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.urlMaps.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tUrlMap urlMap = new UrlMap();\r\n\t\t// Add your code to populate the urlMap object\r\n\t\tCompute.UrlMaps.Update call = computeService.urlMaps().update(\"example-project\", \"example-urlMap\", urlMap);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.urlMaps.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nurl_map = {} # construct your object here\r\nrequest = service.urlMaps().update(body=url_map, project=\"example-project\", urlMap=\"example-urlMap\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.urlMaps.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var urlMap = new UrlMap();\r\n // Add your code to populate the urlMap object\r\n var call = computeService.UrlMaps.Update(urlMap, \"example-project\", \"example-urlMap\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.urlMaps.validate.snippet.json b/compute.urlMaps.validate.snippet.json new file mode 100644 index 0000000..90233a1 --- /dev/null +++ b/compute.urlMaps.validate.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.urlMaps.validate\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tUrlMapsValidateRequest urlMapsValidateRequest = new UrlMapsValidateRequest();\r\n\t\t// Add your code to populate the urlMapsValidateRequest object\r\n\t\tCompute.UrlMaps.Validate call = computeService.urlMaps().validate(\"example-project\", \"example-urlMap\", urlMapsValidateRequest);\r\n\t\tUrlMapsValidateResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.urlMaps.validate\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nurl_maps_validate_request = {} # construct your object here\r\nrequest = service.urlMaps().validate(body=url_maps_validate_request, project=\"example-project\", urlMap=\"example-urlMap\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.urlMaps.validate\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var urlMapsValidateRequest = new UrlMapsValidateRequest();\r\n // Add your code to populate the urlMapsValidateRequest object\r\n var call = computeService.UrlMaps.Validate(urlMapsValidateRequest, \"example-project\", \"example-urlMap\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.vpnTunnels.aggregatedList.snippet.json b/compute.vpnTunnels.aggregatedList.snippet.json new file mode 100644 index 0000000..0f91a5f --- /dev/null +++ b/compute.vpnTunnels.aggregatedList.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.vpnTunnels.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tVpnTunnelAggregatedList response;\r\n\t\tCompute.VpnTunnels.AggregatedList request = computeService.vpnTunnels().aggregatedList(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems().values() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (VpnTunnelsScopedList item : response.getItems().values()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.vpnTunnels.aggregatedList\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.vpnTunnels().aggregatedList(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.vpnTunnels().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.vpnTunnels.aggregatedList\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n VpnTunnelAggregatedList response;\r\n var request = computeService.VpnTunnels.AggregatedList(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items.Values == null)\r\n continue;\r\n\r\n foreach (var item in response.Items.Values)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.vpnTunnels.delete.snippet.json b/compute.vpnTunnels.delete.snippet.json new file mode 100644 index 0000000..e96d742 --- /dev/null +++ b/compute.vpnTunnels.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.vpnTunnels.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.VpnTunnels.Delete request = computeService.vpnTunnels().delete(\"example-project\", \"example-region\", \"example-vpnTunnel\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.vpnTunnels.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.vpnTunnels().delete(project=\"example-project\", region=\"example-region\", vpnTunnel=\"example-vpnTunnel\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.vpnTunnels.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.VpnTunnels.Delete(\"example-project\", \"example-region\", \"example-vpnTunnel\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.vpnTunnels.get.snippet.json b/compute.vpnTunnels.get.snippet.json new file mode 100644 index 0000000..4f02e07 --- /dev/null +++ b/compute.vpnTunnels.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.vpnTunnels.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.VpnTunnels.Get request = computeService.vpnTunnels().get(\"example-project\", \"example-region\", \"example-vpnTunnel\");\r\n\t\tVpnTunnel response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.vpnTunnels.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.vpnTunnels().get(project=\"example-project\", region=\"example-region\", vpnTunnel=\"example-vpnTunnel\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.vpnTunnels.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.VpnTunnels.Get(\"example-project\", \"example-region\", \"example-vpnTunnel\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.vpnTunnels.insert.snippet.json b/compute.vpnTunnels.insert.snippet.json new file mode 100644 index 0000000..bfba7d6 --- /dev/null +++ b/compute.vpnTunnels.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.vpnTunnels.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tVpnTunnel vpnTunnel = new VpnTunnel();\r\n\t\t// Add your code to populate the vpnTunnel object\r\n\t\tCompute.VpnTunnels.Insert call = computeService.vpnTunnels().insert(\"example-project\", \"example-region\", vpnTunnel);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.vpnTunnels.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nvpn_tunnel = {} # construct your object here\r\nrequest = service.vpnTunnels().insert(body=vpn_tunnel, project=\"example-project\", region=\"example-region\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.vpnTunnels.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var vpnTunnel = new VpnTunnel();\r\n // Add your code to populate the vpnTunnel object\r\n var call = computeService.VpnTunnels.Insert(vpnTunnel, \"example-project\", \"example-region\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.vpnTunnels.list.snippet.json b/compute.vpnTunnels.list.snippet.json new file mode 100644 index 0000000..8bfc141 --- /dev/null +++ b/compute.vpnTunnels.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.vpnTunnels.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tVpnTunnelList response;\r\n\t\tCompute.VpnTunnels.List request = computeService.vpnTunnels().list(\"example-project\", \"example-region\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (VpnTunnel item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.vpnTunnels.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.vpnTunnels().list(project=\"example-project\", region=\"example-region\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.vpnTunnels().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.vpnTunnels.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n VpnTunnelList response;\r\n var request = computeService.VpnTunnels.List(\"example-project\", \"example-region\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.zoneOperations.delete.snippet.json b/compute.zoneOperations.delete.snippet.json new file mode 100644 index 0000000..dc6af96 --- /dev/null +++ b/compute.zoneOperations.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.zoneOperations.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.ZoneOperations.Delete request = computeService.zoneOperations().delete(\"example-project\", \"us-central1-a\", \"example-operation\");\r\n\t\t response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.zoneOperations.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.zoneOperations().delete(project=\"example-project\", zone=\"us-central1-a\", operation=\"example-operation\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.zoneOperations.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.ZoneOperations.Delete(\"example-project\", \"us-central1-a\", \"example-operation\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.zoneOperations.get.snippet.json b/compute.zoneOperations.get.snippet.json new file mode 100644 index 0000000..4ac656c --- /dev/null +++ b/compute.zoneOperations.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.zoneOperations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.ZoneOperations.Get request = computeService.zoneOperations().get(\"example-project\", \"us-central1-a\", \"example-operation\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.zoneOperations.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.zoneOperations().get(project=\"example-project\", zone=\"us-central1-a\", operation=\"example-operation\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.zoneOperations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.ZoneOperations.Get(\"example-project\", \"us-central1-a\", \"example-operation\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.zoneOperations.list.snippet.json b/compute.zoneOperations.list.snippet.json new file mode 100644 index 0000000..fe8f458 --- /dev/null +++ b/compute.zoneOperations.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.zoneOperations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tOperationList response;\r\n\t\tCompute.ZoneOperations.List request = computeService.zoneOperations().list(\"example-project\", \"us-central1-a\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Operation item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.zoneOperations.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.zoneOperations().list(project=\"example-project\", zone=\"us-central1-a\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.zoneOperations().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.zoneOperations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n OperationList response;\r\n var request = computeService.ZoneOperations.List(\"example-project\", \"us-central1-a\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.zones.get.snippet.json b/compute.zones.get.snippet.json new file mode 100644 index 0000000..9045a9f --- /dev/null +++ b/compute.zones.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.zones.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tCompute.Zones.Get request = computeService.zones().get(\"example-project\", \"us-central1-a\");\r\n\t\tZone response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for compute.zones.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nservice.zones().get(project=\"example-project\", zone=\"us-central1-a\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.zones.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = computeService.Zones.Get(\"example-project\", \"us-central1-a\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/compute.zones.list.snippet.json b/compute.zones.list.snippet.json new file mode 100644 index 0000000..8e41bf6 --- /dev/null +++ b/compute.zones.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"compute","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for compute.zones.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/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/compute/v1/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.compute.Compute;\r\nimport com.google.api.services.compute.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ComputeSample {\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\tCompute computeService = new Compute.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\tZoneList response;\r\n\t\tCompute.Zones.List request = computeService.zones().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Zone item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for compute.zones.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable compute Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/compute_component/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 'compute' service, at version 'v1'.\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('compute', 'v1', credentials=credentials)\r\n\r\nrequest = service.zones().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.zones().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for compute.zones.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable compute Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/compute_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.compute.v1\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.Compute.v1;\r\nusing Google.Apis.Compute.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ComputeSample\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 computeService = new ComputeService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ZoneList response;\r\n var request = computeService.Zones.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/container.projects.zones.clusters.create.snippet.json b/container.projects.zones.clusters.create.snippet.json new file mode 100644 index 0000000..53c9f03 --- /dev/null +++ b/container.projects.zones.clusters.create.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"container","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for container.projects.zones.clusters.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable container Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/container/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/container/v1/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.container.Container;\r\nimport com.google.api.services.container.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ContainerSample {\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\tContainer containerService = new Container.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\tCreateClusterRequest createClusterRequest = new CreateClusterRequest();\r\n\t\t// Add your code to populate the createClusterRequest object\r\n\t\tContainer.Projects.Zones.Clusters.Create call = containerService.projects().zones().clusters().create(\"example-project\", \"us-central1-a\", createClusterRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for container.projects.zones.clusters.create\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable container Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/container/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 'container' service, at version 'v1'.\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('container', 'v1', credentials=credentials)\r\n\r\ncreate_cluster_request = {} # construct your object here\r\nrequest = service.projects().zones().clusters().create(body=create_cluster_request, projectId=\"example-project\", zone=\"us-central1-a\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for container.projects.zones.clusters.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable container Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/container/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.container.v1\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.Container.v1;\r\nusing Google.Apis.Container.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ContainerSample\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 containerService = new ContainerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var createClusterRequest = new CreateClusterRequest();\r\n // Add your code to populate the createClusterRequest object\r\n var call = containerService.Projects.Zones.Clusters.Create(createClusterRequest, \"example-project\", \"us-central1-a\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/container.projects.zones.clusters.delete.snippet.json b/container.projects.zones.clusters.delete.snippet.json new file mode 100644 index 0000000..cc8da2a --- /dev/null +++ b/container.projects.zones.clusters.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"container","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for container.projects.zones.clusters.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable container Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/container/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/container/v1/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.container.Container;\r\nimport com.google.api.services.container.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ContainerSample {\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\tContainer containerService = new Container.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\tContainer.Projects.Zones.Clusters.Delete request = containerService.projects().zones().clusters().delete(\"example-project\", \"us-central1-a\", \"example-clusterId\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for container.projects.zones.clusters.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable container Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/container/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 'container' service, at version 'v1'.\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('container', 'v1', credentials=credentials)\r\n\r\nservice.projects().zones().clusters().delete(projectId=\"example-project\", zone=\"us-central1-a\", clusterId=\"example-clusterId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for container.projects.zones.clusters.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable container Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/container/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.container.v1\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.Container.v1;\r\nusing Google.Apis.Container.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ContainerSample\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 containerService = new ContainerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = containerService.Projects.Zones.Clusters.Delete(\"example-project\", \"us-central1-a\", \"example-clusterId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/container.projects.zones.clusters.get.snippet.json b/container.projects.zones.clusters.get.snippet.json new file mode 100644 index 0000000..f3ba572 --- /dev/null +++ b/container.projects.zones.clusters.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"container","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for container.projects.zones.clusters.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable container Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/container/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/container/v1/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.container.Container;\r\nimport com.google.api.services.container.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ContainerSample {\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\tContainer containerService = new Container.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\tContainer.Projects.Zones.Clusters.Get request = containerService.projects().zones().clusters().get(\"example-project\", \"us-central1-a\", \"example-clusterId\");\r\n\t\tCluster response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for container.projects.zones.clusters.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable container Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/container/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 'container' service, at version 'v1'.\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('container', 'v1', credentials=credentials)\r\n\r\nservice.projects().zones().clusters().get(projectId=\"example-project\", zone=\"us-central1-a\", clusterId=\"example-clusterId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for container.projects.zones.clusters.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable container Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/container/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.container.v1\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.Container.v1;\r\nusing Google.Apis.Container.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ContainerSample\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 containerService = new ContainerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = containerService.Projects.Zones.Clusters.Get(\"example-project\", \"us-central1-a\", \"example-clusterId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/container.projects.zones.clusters.list.snippet.json b/container.projects.zones.clusters.list.snippet.json new file mode 100644 index 0000000..fd9a09e --- /dev/null +++ b/container.projects.zones.clusters.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"container","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for container.projects.zones.clusters.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable container Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/container/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/container/v1/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.container.Container;\r\nimport com.google.api.services.container.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ContainerSample {\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\tContainer containerService = new Container.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\tContainer.Projects.Zones.Clusters.List request = containerService.projects().zones().clusters().list(\"example-project\", \"us-central1-a\");\r\n\t\tListClustersResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for container.projects.zones.clusters.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable container Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/container/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 'container' service, at version 'v1'.\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('container', 'v1', credentials=credentials)\r\n\r\nservice.projects().zones().clusters().list(projectId=\"example-project\", zone=\"us-central1-a\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for container.projects.zones.clusters.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable container Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/container/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.container.v1\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.Container.v1;\r\nusing Google.Apis.Container.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ContainerSample\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 containerService = new ContainerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = containerService.Projects.Zones.Clusters.List(\"example-project\", \"us-central1-a\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/container.projects.zones.clusters.update.snippet.json b/container.projects.zones.clusters.update.snippet.json new file mode 100644 index 0000000..56abd90 --- /dev/null +++ b/container.projects.zones.clusters.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"container","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for container.projects.zones.clusters.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable container Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/container/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/container/v1/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.container.Container;\r\nimport com.google.api.services.container.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ContainerSample {\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\tContainer containerService = new Container.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\tUpdateClusterRequest updateClusterRequest = new UpdateClusterRequest();\r\n\t\t// Add your code to populate the updateClusterRequest object\r\n\t\tContainer.Projects.Zones.Clusters.Update call = containerService.projects().zones().clusters().update(\"example-project\", \"us-central1-a\", \"example-clusterId\", updateClusterRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for container.projects.zones.clusters.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable container Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/container/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 'container' service, at version 'v1'.\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('container', 'v1', credentials=credentials)\r\n\r\nupdate_cluster_request = {} # construct your object here\r\nrequest = service.projects().zones().clusters().update(body=update_cluster_request, projectId=\"example-project\", zone=\"us-central1-a\", clusterId=\"example-clusterId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for container.projects.zones.clusters.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable container Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/container/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.container.v1\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.Container.v1;\r\nusing Google.Apis.Container.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ContainerSample\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 containerService = new ContainerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var updateClusterRequest = new UpdateClusterRequest();\r\n // Add your code to populate the updateClusterRequest object\r\n var call = containerService.Projects.Zones.Clusters.Update(updateClusterRequest, \"example-project\", \"us-central1-a\", \"example-clusterId\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/container.projects.zones.getServerconfig.snippet.json b/container.projects.zones.getServerconfig.snippet.json new file mode 100644 index 0000000..4e5fe66 --- /dev/null +++ b/container.projects.zones.getServerconfig.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"container","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for container.projects.zones.getServerconfig\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable container Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/container/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/container/v1/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.container.Container;\r\nimport com.google.api.services.container.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ContainerSample {\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\tContainer containerService = new Container.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\tContainer.Projects.Zones.GetServerconfig request = containerService.projects().zones().getServerconfig(\"example-project\", \"us-central1-a\");\r\n\t\tServerConfig response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for container.projects.zones.getServerconfig\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable container Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/container/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 'container' service, at version 'v1'.\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('container', 'v1', credentials=credentials)\r\n\r\nservice.projects().zones().getServerconfig(projectId=\"example-project\", zone=\"us-central1-a\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for container.projects.zones.getServerconfig\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable container Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/container/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.container.v1\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.Container.v1;\r\nusing Google.Apis.Container.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ContainerSample\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 containerService = new ContainerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = containerService.Projects.Zones.GetServerconfig(\"example-project\", \"us-central1-a\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/container.projects.zones.operations.get.snippet.json b/container.projects.zones.operations.get.snippet.json new file mode 100644 index 0000000..ed1a42b --- /dev/null +++ b/container.projects.zones.operations.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"container","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for container.projects.zones.operations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable container Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/container/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/container/v1/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.container.Container;\r\nimport com.google.api.services.container.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ContainerSample {\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\tContainer containerService = new Container.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\tContainer.Projects.Zones.Operations.Get request = containerService.projects().zones().operations().get(\"example-project\", \"us-central1-a\", \"example-operationId\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for container.projects.zones.operations.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable container Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/container/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 'container' service, at version 'v1'.\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('container', 'v1', credentials=credentials)\r\n\r\nservice.projects().zones().operations().get(projectId=\"example-project\", zone=\"us-central1-a\", operationId=\"example-operationId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for container.projects.zones.operations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable container Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/container/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.container.v1\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.Container.v1;\r\nusing Google.Apis.Container.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ContainerSample\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 containerService = new ContainerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = containerService.Projects.Zones.Operations.Get(\"example-project\", \"us-central1-a\", \"example-operationId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/container.projects.zones.operations.list.snippet.json b/container.projects.zones.operations.list.snippet.json new file mode 100644 index 0000000..4a49497 --- /dev/null +++ b/container.projects.zones.operations.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"container","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for container.projects.zones.operations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable container Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/container/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/container/v1/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.container.Container;\r\nimport com.google.api.services.container.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ContainerSample {\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\tContainer containerService = new Container.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\tContainer.Projects.Zones.Operations.List request = containerService.projects().zones().operations().list(\"example-project\", \"us-central1-a\");\r\n\t\tListOperationsResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for container.projects.zones.operations.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable container Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/container/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 'container' service, at version 'v1'.\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('container', 'v1', credentials=credentials)\r\n\r\nservice.projects().zones().operations().list(projectId=\"example-project\", zone=\"us-central1-a\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for container.projects.zones.operations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable container Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/container/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.container.v1\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.Container.v1;\r\nusing Google.Apis.Container.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ContainerSample\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 containerService = new ContainerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = containerService.Projects.Zones.Operations.List(\"example-project\", \"us-central1-a\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dataflow.projects.jobs.create.snippet.json b/dataflow.projects.jobs.create.snippet.json new file mode 100644 index 0000000..b383ca1 --- /dev/null +++ b/dataflow.projects.jobs.create.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dataflow","apiVersion":"v1b3","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dataflow.projects.jobs.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataflow Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataflow/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/dataflow/v1b3/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.dataflow.Dataflow;\r\nimport com.google.api.services.dataflow.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DataflowSample {\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\tDataflow dataflowService = new Dataflow.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\tJob job = new Job();\r\n\t\t// Add your code to populate the job object\r\n\t\tDataflow.Projects.Jobs.Create call = dataflowService.projects().jobs().create(\"example-project\", job);\r\n\t\tJob response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for dataflow.projects.jobs.create\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dataflow Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dataflow/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 'dataflow' service, at version 'v1b3'.\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('dataflow', 'v1b3', credentials=credentials)\r\n\r\njob = {} # construct your object here\r\nrequest = service.projects().jobs().create(body=job, projectId=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dataflow.projects.jobs.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataflow Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataflow/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dataflow.v1b3\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.Dataflow.v1b3;\r\nusing Google.Apis.Dataflow.v1b3.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DataflowSample\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 dataflowService = new DataflowService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var job = new Job();\r\n // Add your code to populate the job object\r\n var call = dataflowService.Projects.Jobs.Create(job, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dataflow.projects.jobs.get.snippet.json b/dataflow.projects.jobs.get.snippet.json new file mode 100644 index 0000000..1a57640 --- /dev/null +++ b/dataflow.projects.jobs.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dataflow","apiVersion":"v1b3","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dataflow.projects.jobs.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataflow Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataflow/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/dataflow/v1b3/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.dataflow.Dataflow;\r\nimport com.google.api.services.dataflow.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DataflowSample {\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\tDataflow dataflowService = new Dataflow.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\tDataflow.Projects.Jobs.Get request = dataflowService.projects().jobs().get(\"example-project\", \"example-jobId\");\r\n\t\tJob response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for dataflow.projects.jobs.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dataflow Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dataflow/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 'dataflow' service, at version 'v1b3'.\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('dataflow', 'v1b3', credentials=credentials)\r\n\r\nservice.projects().jobs().get(projectId=\"example-project\", jobId=\"example-jobId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dataflow.projects.jobs.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataflow Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataflow/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dataflow.v1b3\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.Dataflow.v1b3;\r\nusing Google.Apis.Dataflow.v1b3.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DataflowSample\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 dataflowService = new DataflowService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = dataflowService.Projects.Jobs.Get(\"example-project\", \"example-jobId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dataflow.projects.jobs.getMetrics.snippet.json b/dataflow.projects.jobs.getMetrics.snippet.json new file mode 100644 index 0000000..877540a --- /dev/null +++ b/dataflow.projects.jobs.getMetrics.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dataflow","apiVersion":"v1b3","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dataflow.projects.jobs.getMetrics\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataflow Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataflow/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/dataflow/v1b3/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.dataflow.Dataflow;\r\nimport com.google.api.services.dataflow.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DataflowSample {\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\tDataflow dataflowService = new Dataflow.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\tDataflow.Projects.Jobs.GetMetrics request = dataflowService.projects().jobs().getMetrics(\"example-project\", \"example-jobId\");\r\n\t\tJobMetrics response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for dataflow.projects.jobs.getMetrics\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dataflow Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dataflow/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 'dataflow' service, at version 'v1b3'.\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('dataflow', 'v1b3', credentials=credentials)\r\n\r\nservice.projects().jobs().getMetrics(projectId=\"example-project\", jobId=\"example-jobId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dataflow.projects.jobs.getMetrics\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataflow Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataflow/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dataflow.v1b3\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.Dataflow.v1b3;\r\nusing Google.Apis.Dataflow.v1b3.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DataflowSample\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 dataflowService = new DataflowService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = dataflowService.Projects.Jobs.GetMetrics(\"example-project\", \"example-jobId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dataflow.projects.jobs.list.snippet.json b/dataflow.projects.jobs.list.snippet.json new file mode 100644 index 0000000..8cc0629 --- /dev/null +++ b/dataflow.projects.jobs.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dataflow","apiVersion":"v1b3","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dataflow.projects.jobs.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataflow Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataflow/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/dataflow/v1b3/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.dataflow.Dataflow;\r\nimport com.google.api.services.dataflow.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DataflowSample {\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\tDataflow dataflowService = new Dataflow.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\tListJobsResponse response;\r\n\t\tDataflow.Projects.Jobs.List request = dataflowService.projects().jobs().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getJobs() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Job item : response.getJobs()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for dataflow.projects.jobs.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dataflow Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dataflow/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 'dataflow' service, at version 'v1b3'.\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('dataflow', 'v1b3', credentials=credentials)\r\n\r\nrequest = service.projects().jobs().list(projectId=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.projects().jobs().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dataflow.projects.jobs.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataflow Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataflow/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dataflow.v1b3\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.Dataflow.v1b3;\r\nusing Google.Apis.Dataflow.v1b3.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DataflowSample\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 dataflowService = new DataflowService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListJobsResponse response;\r\n var request = dataflowService.Projects.Jobs.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Jobs == null)\r\n continue;\r\n\r\n foreach (var item in response.Jobs)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dataflow.projects.jobs.messages.list.snippet.json b/dataflow.projects.jobs.messages.list.snippet.json new file mode 100644 index 0000000..c09fe3d --- /dev/null +++ b/dataflow.projects.jobs.messages.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dataflow","apiVersion":"v1b3","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dataflow.projects.jobs.messages.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataflow Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataflow/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/dataflow/v1b3/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.dataflow.Dataflow;\r\nimport com.google.api.services.dataflow.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DataflowSample {\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\tDataflow dataflowService = new Dataflow.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\tListJobMessagesResponse response;\r\n\t\tDataflow.Projects.Jobs.Messages.List request = dataflowService.projects().jobs().messages().list(\"example-project\", \"example-jobId\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getJobMessages() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (JobMessage item : response.getJobMessages()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for dataflow.projects.jobs.messages.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dataflow Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dataflow/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 'dataflow' service, at version 'v1b3'.\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('dataflow', 'v1b3', credentials=credentials)\r\n\r\nrequest = service.projects().jobs().messages().list(projectId=\"example-project\", jobId=\"example-jobId\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.projects().jobs().messages().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dataflow.projects.jobs.messages.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataflow Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataflow/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dataflow.v1b3\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.Dataflow.v1b3;\r\nusing Google.Apis.Dataflow.v1b3.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DataflowSample\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 dataflowService = new DataflowService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListJobMessagesResponse response;\r\n var request = dataflowService.Projects.Jobs.Messages.List(\"example-project\", \"example-jobId\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.JobMessages == null)\r\n continue;\r\n\r\n foreach (var item in response.JobMessages)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dataflow.projects.jobs.update.snippet.json b/dataflow.projects.jobs.update.snippet.json new file mode 100644 index 0000000..effd79b --- /dev/null +++ b/dataflow.projects.jobs.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dataflow","apiVersion":"v1b3","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dataflow.projects.jobs.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataflow Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataflow/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/dataflow/v1b3/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.dataflow.Dataflow;\r\nimport com.google.api.services.dataflow.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DataflowSample {\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\tDataflow dataflowService = new Dataflow.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\tJob job = new Job();\r\n\t\t// Add your code to populate the job object\r\n\t\tDataflow.Projects.Jobs.Update call = dataflowService.projects().jobs().update(\"example-project\", \"example-jobId\", job);\r\n\t\tJob response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for dataflow.projects.jobs.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dataflow Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dataflow/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 'dataflow' service, at version 'v1b3'.\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('dataflow', 'v1b3', credentials=credentials)\r\n\r\njob = {} # construct your object here\r\nrequest = service.projects().jobs().update(body=job, projectId=\"example-project\", jobId=\"example-jobId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dataflow.projects.jobs.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataflow Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataflow/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dataflow.v1b3\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.Dataflow.v1b3;\r\nusing Google.Apis.Dataflow.v1b3.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DataflowSample\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 dataflowService = new DataflowService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var job = new Job();\r\n // Add your code to populate the job object\r\n var call = dataflowService.Projects.Jobs.Update(job, \"example-project\", \"example-jobId\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dataflow.projects.jobs.workItems.lease.snippet.json b/dataflow.projects.jobs.workItems.lease.snippet.json new file mode 100644 index 0000000..d6d42d0 --- /dev/null +++ b/dataflow.projects.jobs.workItems.lease.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dataflow","apiVersion":"v1b3","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dataflow.projects.jobs.workItems.lease\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataflow Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataflow/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/dataflow/v1b3/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.dataflow.Dataflow;\r\nimport com.google.api.services.dataflow.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DataflowSample {\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\tDataflow dataflowService = new Dataflow.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\tLeaseWorkItemRequest leaseWorkItemRequest = new LeaseWorkItemRequest();\r\n\t\t// Add your code to populate the leaseWorkItemRequest object\r\n\t\tDataflow.Projects.Jobs.WorkItems.Lease call = dataflowService.projects().jobs().workItems().lease(\"example-project\", \"example-jobId\", leaseWorkItemRequest);\r\n\t\tLeaseWorkItemResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for dataflow.projects.jobs.workItems.lease\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dataflow Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dataflow/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 'dataflow' service, at version 'v1b3'.\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('dataflow', 'v1b3', credentials=credentials)\r\n\r\nlease_work_item_request = {} # construct your object here\r\nrequest = service.projects().jobs().workItems().lease(body=lease_work_item_request, projectId=\"example-project\", jobId=\"example-jobId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dataflow.projects.jobs.workItems.lease\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataflow Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataflow/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dataflow.v1b3\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.Dataflow.v1b3;\r\nusing Google.Apis.Dataflow.v1b3.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DataflowSample\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 dataflowService = new DataflowService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var leaseWorkItemRequest = new LeaseWorkItemRequest();\r\n // Add your code to populate the leaseWorkItemRequest object\r\n var call = dataflowService.Projects.Jobs.WorkItems.Lease(leaseWorkItemRequest, \"example-project\", \"example-jobId\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dataflow.projects.jobs.workItems.reportStatus.snippet.json b/dataflow.projects.jobs.workItems.reportStatus.snippet.json new file mode 100644 index 0000000..39afe43 --- /dev/null +++ b/dataflow.projects.jobs.workItems.reportStatus.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dataflow","apiVersion":"v1b3","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dataflow.projects.jobs.workItems.reportStatus\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataflow Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataflow/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/dataflow/v1b3/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.dataflow.Dataflow;\r\nimport com.google.api.services.dataflow.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DataflowSample {\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\tDataflow dataflowService = new Dataflow.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\tReportWorkItemStatusRequest reportWorkItemStatusRequest = new ReportWorkItemStatusRequest();\r\n\t\t// Add your code to populate the reportWorkItemStatusRequest object\r\n\t\tDataflow.Projects.Jobs.WorkItems.ReportStatus call = dataflowService.projects().jobs().workItems().reportStatus(\"example-project\", \"example-jobId\", reportWorkItemStatusRequest);\r\n\t\tReportWorkItemStatusResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for dataflow.projects.jobs.workItems.reportStatus\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dataflow Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dataflow/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 'dataflow' service, at version 'v1b3'.\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('dataflow', 'v1b3', credentials=credentials)\r\n\r\nreport_work_item_status_request = {} # construct your object here\r\nrequest = service.projects().jobs().workItems().reportStatus(body=report_work_item_status_request, projectId=\"example-project\", jobId=\"example-jobId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dataflow.projects.jobs.workItems.reportStatus\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataflow Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataflow/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dataflow.v1b3\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.Dataflow.v1b3;\r\nusing Google.Apis.Dataflow.v1b3.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DataflowSample\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 dataflowService = new DataflowService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var reportWorkItemStatusRequest = new ReportWorkItemStatusRequest();\r\n // Add your code to populate the reportWorkItemStatusRequest object\r\n var call = dataflowService.Projects.Jobs.WorkItems.ReportStatus(reportWorkItemStatusRequest, \"example-project\", \"example-jobId\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dataflow.projects.workerMessages.snippet.json b/dataflow.projects.workerMessages.snippet.json new file mode 100644 index 0000000..c3fd533 --- /dev/null +++ b/dataflow.projects.workerMessages.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dataflow","apiVersion":"v1b3","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dataflow.projects.workerMessages\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataflow Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataflow/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/dataflow/v1b3/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.dataflow.Dataflow;\r\nimport com.google.api.services.dataflow.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DataflowSample {\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\tDataflow dataflowService = new Dataflow.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\tSendWorkerMessagesRequest sendWorkerMessagesRequest = new SendWorkerMessagesRequest();\r\n\t\t// Add your code to populate the sendWorkerMessagesRequest object\r\n\t\tDataflow.Projects.WorkerMessages call = dataflowService.projects().workerMessages(\"example-project\", sendWorkerMessagesRequest);\r\n\t\tSendWorkerMessagesResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for dataflow.projects.workerMessages\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dataflow Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dataflow/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 'dataflow' service, at version 'v1b3'.\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('dataflow', 'v1b3', credentials=credentials)\r\n\r\nsend_worker_messages_request = {} # construct your object here\r\nrequest = service.projects().workerMessages(body=send_worker_messages_request, projectId=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dataflow.projects.workerMessages\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataflow Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataflow/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dataflow.v1b3\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.Dataflow.v1b3;\r\nusing Google.Apis.Dataflow.v1b3.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DataflowSample\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 dataflowService = new DataflowService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var sendWorkerMessagesRequest = new SendWorkerMessagesRequest();\r\n // Add your code to populate the sendWorkerMessagesRequest object\r\n var call = dataflowService.Projects.WorkerMessages(sendWorkerMessagesRequest, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dataproc.media.download.snippet.json b/dataproc.media.download.snippet.json new file mode 100644 index 0000000..831f2a7 --- /dev/null +++ b/dataproc.media.download.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dataproc","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dataproc.media.download\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataproc Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataproc/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/dataproc/v1/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.dataproc.Dataproc;\r\nimport com.google.api.services.dataproc.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DataprocSample {\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\tDataproc dataprocService = new Dataproc.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\tDataproc.Media.Download request = dataprocService.media().download(\"example-resourceName\");\r\n\t\tMedia response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for dataproc.media.download\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dataproc Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dataproc/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 'dataproc' service, at version 'v1'.\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('dataproc', 'v1', credentials=credentials)\r\n\r\nservice.media().download(resourceName=\"example-resourceName\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dataproc.media.download\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataproc Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataproc/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dataproc.v1\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.Dataproc.v1;\r\nusing Google.Apis.Dataproc.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DataprocSample\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 dataprocService = new DataprocService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = dataprocService.Media.Download(\"example-resourceName\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dataproc.media.upload.snippet.json b/dataproc.media.upload.snippet.json new file mode 100644 index 0000000..d81d4d3 --- /dev/null +++ b/dataproc.media.upload.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dataproc","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dataproc.media.upload\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataproc Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataproc/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/dataproc/v1/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.dataproc.Dataproc;\r\nimport com.google.api.services.dataproc.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DataprocSample {\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\tDataproc dataprocService = new Dataproc.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\tMedia media = new Media();\r\n\t\t// Add your code to populate the media object\r\n\t\tDataproc.Media.Upload call = dataprocService.media().upload(\"example-resourceName\", media);\r\n\t\tMedia response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for dataproc.media.upload\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dataproc Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dataproc/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 'dataproc' service, at version 'v1'.\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('dataproc', 'v1', credentials=credentials)\r\n\r\nmedia = {} # construct your object here\r\nrequest = service.media().upload(body=media, resourceName=\"example-resourceName\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dataproc.media.upload\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dataproc Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dataproc/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dataproc.v1\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.Dataproc.v1;\r\nusing Google.Apis.Dataproc.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DataprocSample\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 dataprocService = new DataprocService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var media = new Media();\r\n // Add your code to populate the media object\r\n var call = dataprocService.Media.Upload(media, \"example-resourceName\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/datastore.datasets.allocateIds.snippet.json b/datastore.datasets.allocateIds.snippet.json new file mode 100644 index 0000000..dd2d22f --- /dev/null +++ b/datastore.datasets.allocateIds.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"datastore","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for datastore.datasets.allocateIds\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable datastore Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/datastore/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/datastore/v1beta2/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.datastore.Datastore;\r\nimport com.google.api.services.datastore.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DatastoreSample {\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\tDatastore datastoreService = new Datastore.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\tAllocateIdsRequest allocateIdsRequest = new AllocateIdsRequest();\r\n\t\t// Add your code to populate the allocateIdsRequest object\r\n\t\tDatastore.Datasets.AllocateIds call = datastoreService.datasets().allocateIds(\"example-datasetId\", allocateIdsRequest);\r\n\t\tAllocateIdsResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for datastore.datasets.allocateIds\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable datastore Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/datastore/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 'datastore' service, at version 'v1beta2'.\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('datastore', 'v1beta2', credentials=credentials)\r\n\r\nallocate_ids_request = {} # construct your object here\r\nrequest = service.datasets().allocateIds(body=allocate_ids_request, datasetId=\"example-datasetId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for datastore.datasets.allocateIds\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable datastore Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/datastore/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.datastore.v1beta2\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.Datastore.v1beta2;\r\nusing Google.Apis.Datastore.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DatastoreSample\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 datastoreService = new DatastoreService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var allocateIdsRequest = new AllocateIdsRequest();\r\n // Add your code to populate the allocateIdsRequest object\r\n var call = datastoreService.Datasets.AllocateIds(allocateIdsRequest, \"example-datasetId\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/datastore.datasets.beginTransaction.snippet.json b/datastore.datasets.beginTransaction.snippet.json new file mode 100644 index 0000000..dc7e89d --- /dev/null +++ b/datastore.datasets.beginTransaction.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"datastore","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for datastore.datasets.beginTransaction\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable datastore Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/datastore/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/datastore/v1beta2/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.datastore.Datastore;\r\nimport com.google.api.services.datastore.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DatastoreSample {\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\tDatastore datastoreService = new Datastore.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\tBeginTransactionRequest beginTransactionRequest = new BeginTransactionRequest();\r\n\t\t// Add your code to populate the beginTransactionRequest object\r\n\t\tDatastore.Datasets.BeginTransaction call = datastoreService.datasets().beginTransaction(\"example-datasetId\", beginTransactionRequest);\r\n\t\tBeginTransactionResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for datastore.datasets.beginTransaction\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable datastore Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/datastore/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 'datastore' service, at version 'v1beta2'.\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('datastore', 'v1beta2', credentials=credentials)\r\n\r\nbegin_transaction_request = {} # construct your object here\r\nrequest = service.datasets().beginTransaction(body=begin_transaction_request, datasetId=\"example-datasetId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for datastore.datasets.beginTransaction\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable datastore Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/datastore/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.datastore.v1beta2\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.Datastore.v1beta2;\r\nusing Google.Apis.Datastore.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DatastoreSample\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 datastoreService = new DatastoreService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var beginTransactionRequest = new BeginTransactionRequest();\r\n // Add your code to populate the beginTransactionRequest object\r\n var call = datastoreService.Datasets.BeginTransaction(beginTransactionRequest, \"example-datasetId\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/datastore.datasets.commit.snippet.json b/datastore.datasets.commit.snippet.json new file mode 100644 index 0000000..da11546 --- /dev/null +++ b/datastore.datasets.commit.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"datastore","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for datastore.datasets.commit\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable datastore Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/datastore/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/datastore/v1beta2/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.datastore.Datastore;\r\nimport com.google.api.services.datastore.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DatastoreSample {\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\tDatastore datastoreService = new Datastore.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\tCommitRequest commitRequest = new CommitRequest();\r\n\t\t// Add your code to populate the commitRequest object\r\n\t\tDatastore.Datasets.Commit call = datastoreService.datasets().commit(\"example-datasetId\", commitRequest);\r\n\t\tCommitResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for datastore.datasets.commit\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable datastore Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/datastore/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 'datastore' service, at version 'v1beta2'.\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('datastore', 'v1beta2', credentials=credentials)\r\n\r\ncommit_request = {} # construct your object here\r\nrequest = service.datasets().commit(body=commit_request, datasetId=\"example-datasetId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for datastore.datasets.commit\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable datastore Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/datastore/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.datastore.v1beta2\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.Datastore.v1beta2;\r\nusing Google.Apis.Datastore.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DatastoreSample\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 datastoreService = new DatastoreService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var commitRequest = new CommitRequest();\r\n // Add your code to populate the commitRequest object\r\n var call = datastoreService.Datasets.Commit(commitRequest, \"example-datasetId\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/datastore.datasets.lookup.snippet.json b/datastore.datasets.lookup.snippet.json new file mode 100644 index 0000000..cea6a65 --- /dev/null +++ b/datastore.datasets.lookup.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"datastore","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for datastore.datasets.lookup\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable datastore Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/datastore/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/datastore/v1beta2/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.datastore.Datastore;\r\nimport com.google.api.services.datastore.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DatastoreSample {\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\tDatastore datastoreService = new Datastore.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\tLookupRequest lookupRequest = new LookupRequest();\r\n\t\t// Add your code to populate the lookupRequest object\r\n\t\tDatastore.Datasets.Lookup call = datastoreService.datasets().lookup(\"example-datasetId\", lookupRequest);\r\n\t\tLookupResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for datastore.datasets.lookup\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable datastore Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/datastore/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 'datastore' service, at version 'v1beta2'.\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('datastore', 'v1beta2', credentials=credentials)\r\n\r\nlookup_request = {} # construct your object here\r\nrequest = service.datasets().lookup(body=lookup_request, datasetId=\"example-datasetId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for datastore.datasets.lookup\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable datastore Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/datastore/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.datastore.v1beta2\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.Datastore.v1beta2;\r\nusing Google.Apis.Datastore.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DatastoreSample\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 datastoreService = new DatastoreService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var lookupRequest = new LookupRequest();\r\n // Add your code to populate the lookupRequest object\r\n var call = datastoreService.Datasets.Lookup(lookupRequest, \"example-datasetId\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/datastore.datasets.rollback.snippet.json b/datastore.datasets.rollback.snippet.json new file mode 100644 index 0000000..62c029b --- /dev/null +++ b/datastore.datasets.rollback.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"datastore","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for datastore.datasets.rollback\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable datastore Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/datastore/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/datastore/v1beta2/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.datastore.Datastore;\r\nimport com.google.api.services.datastore.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DatastoreSample {\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\tDatastore datastoreService = new Datastore.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\tRollbackRequest rollbackRequest = new RollbackRequest();\r\n\t\t// Add your code to populate the rollbackRequest object\r\n\t\tDatastore.Datasets.Rollback call = datastoreService.datasets().rollback(\"example-datasetId\", rollbackRequest);\r\n\t\tRollbackResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for datastore.datasets.rollback\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable datastore Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/datastore/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 'datastore' service, at version 'v1beta2'.\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('datastore', 'v1beta2', credentials=credentials)\r\n\r\nrollback_request = {} # construct your object here\r\nrequest = service.datasets().rollback(body=rollback_request, datasetId=\"example-datasetId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for datastore.datasets.rollback\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable datastore Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/datastore/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.datastore.v1beta2\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.Datastore.v1beta2;\r\nusing Google.Apis.Datastore.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DatastoreSample\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 datastoreService = new DatastoreService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var rollbackRequest = new RollbackRequest();\r\n // Add your code to populate the rollbackRequest object\r\n var call = datastoreService.Datasets.Rollback(rollbackRequest, \"example-datasetId\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/datastore.datasets.runQuery.snippet.json b/datastore.datasets.runQuery.snippet.json new file mode 100644 index 0000000..22be870 --- /dev/null +++ b/datastore.datasets.runQuery.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"datastore","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for datastore.datasets.runQuery\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable datastore Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/datastore/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/datastore/v1beta2/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.datastore.Datastore;\r\nimport com.google.api.services.datastore.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DatastoreSample {\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\tDatastore datastoreService = new Datastore.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\tRunQueryRequest runQueryRequest = new RunQueryRequest();\r\n\t\t// Add your code to populate the runQueryRequest object\r\n\t\tDatastore.Datasets.RunQuery call = datastoreService.datasets().runQuery(\"example-datasetId\", runQueryRequest);\r\n\t\tRunQueryResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for datastore.datasets.runQuery\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable datastore Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/datastore/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 'datastore' service, at version 'v1beta2'.\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('datastore', 'v1beta2', credentials=credentials)\r\n\r\nrun_query_request = {} # construct your object here\r\nrequest = service.datasets().runQuery(body=run_query_request, datasetId=\"example-datasetId\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for datastore.datasets.runQuery\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable datastore Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/datastore/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.datastore.v1beta2\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.Datastore.v1beta2;\r\nusing Google.Apis.Datastore.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DatastoreSample\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 datastoreService = new DatastoreService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var runQueryRequest = new RunQueryRequest();\r\n // Add your code to populate the runQueryRequest object\r\n var call = datastoreService.Datasets.RunQuery(runQueryRequest, \"example-datasetId\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/deploymentmanager.deployments.cancelPreview.snippet.json b/deploymentmanager.deployments.cancelPreview.snippet.json new file mode 100644 index 0000000..5c3b0e4 --- /dev/null +++ b/deploymentmanager.deployments.cancelPreview.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"deploymentmanager","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for deploymentmanager.deployments.cancelPreview\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/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/deploymentmanager/v2/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.deploymentmanager.Deploymentmanager;\r\nimport com.google.api.services.deploymentmanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DeploymentmanagerSample {\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\tDeploymentmanager deploymentmanagerService = new Deploymentmanager.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\tDeploymentsCancelPreviewRequest deploymentsCancelPreviewRequest = new DeploymentsCancelPreviewRequest();\r\n\t\t// Add your code to populate the deploymentsCancelPreviewRequest object\r\n\t\tDeploymentmanager.Deployments.CancelPreview call = deploymentmanagerService.deployments().cancelPreview(\"example-project\", \"example-deployment\", deploymentsCancelPreviewRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for deploymentmanager.deployments.cancelPreview\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/deploymentmanager/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 'deploymentmanager' service, at version 'v2'.\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('deploymentmanager', 'v2', credentials=credentials)\r\n\r\ndeployments_cancel_preview_request = {} # construct your object here\r\nrequest = service.deployments().cancelPreview(body=deployments_cancel_preview_request, project=\"example-project\", deployment=\"example-deployment\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for deploymentmanager.deployments.cancelPreview\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.deploymentmanager.v2\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.Deploymentmanager.v2;\r\nusing Google.Apis.Deploymentmanager.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DeploymentmanagerSample\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 deploymentmanagerService = new DeploymentmanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var deploymentsCancelPreviewRequest = new DeploymentsCancelPreviewRequest();\r\n // Add your code to populate the deploymentsCancelPreviewRequest object\r\n var call = deploymentmanagerService.Deployments.CancelPreview(deploymentsCancelPreviewRequest, \"example-project\", \"example-deployment\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/deploymentmanager.deployments.delete.snippet.json b/deploymentmanager.deployments.delete.snippet.json new file mode 100644 index 0000000..4a2644d --- /dev/null +++ b/deploymentmanager.deployments.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"deploymentmanager","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for deploymentmanager.deployments.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/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/deploymentmanager/v2/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.deploymentmanager.Deploymentmanager;\r\nimport com.google.api.services.deploymentmanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DeploymentmanagerSample {\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\tDeploymentmanager deploymentmanagerService = new Deploymentmanager.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\tDeploymentmanager.Deployments.Delete request = deploymentmanagerService.deployments().delete(\"example-project\", \"example-deployment\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for deploymentmanager.deployments.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/deploymentmanager/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 'deploymentmanager' service, at version 'v2'.\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('deploymentmanager', 'v2', credentials=credentials)\r\n\r\nservice.deployments().delete(project=\"example-project\", deployment=\"example-deployment\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for deploymentmanager.deployments.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.deploymentmanager.v2\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.Deploymentmanager.v2;\r\nusing Google.Apis.Deploymentmanager.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DeploymentmanagerSample\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 deploymentmanagerService = new DeploymentmanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = deploymentmanagerService.Deployments.Delete(\"example-project\", \"example-deployment\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/deploymentmanager.deployments.get.snippet.json b/deploymentmanager.deployments.get.snippet.json new file mode 100644 index 0000000..ab4d541 --- /dev/null +++ b/deploymentmanager.deployments.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"deploymentmanager","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for deploymentmanager.deployments.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/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/deploymentmanager/v2/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.deploymentmanager.Deploymentmanager;\r\nimport com.google.api.services.deploymentmanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DeploymentmanagerSample {\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\tDeploymentmanager deploymentmanagerService = new Deploymentmanager.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\tDeploymentmanager.Deployments.Get request = deploymentmanagerService.deployments().get(\"example-project\", \"example-deployment\");\r\n\t\tDeployment response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for deploymentmanager.deployments.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/deploymentmanager/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 'deploymentmanager' service, at version 'v2'.\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('deploymentmanager', 'v2', credentials=credentials)\r\n\r\nservice.deployments().get(project=\"example-project\", deployment=\"example-deployment\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for deploymentmanager.deployments.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.deploymentmanager.v2\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.Deploymentmanager.v2;\r\nusing Google.Apis.Deploymentmanager.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DeploymentmanagerSample\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 deploymentmanagerService = new DeploymentmanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = deploymentmanagerService.Deployments.Get(\"example-project\", \"example-deployment\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/deploymentmanager.deployments.insert.snippet.json b/deploymentmanager.deployments.insert.snippet.json new file mode 100644 index 0000000..4f6d679 --- /dev/null +++ b/deploymentmanager.deployments.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"deploymentmanager","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for deploymentmanager.deployments.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/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/deploymentmanager/v2/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.deploymentmanager.Deploymentmanager;\r\nimport com.google.api.services.deploymentmanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DeploymentmanagerSample {\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\tDeploymentmanager deploymentmanagerService = new Deploymentmanager.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\tDeployment deployment = new Deployment();\r\n\t\t// Add your code to populate the deployment object\r\n\t\tDeploymentmanager.Deployments.Insert call = deploymentmanagerService.deployments().insert(\"example-project\", deployment);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for deploymentmanager.deployments.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/deploymentmanager/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 'deploymentmanager' service, at version 'v2'.\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('deploymentmanager', 'v2', credentials=credentials)\r\n\r\ndeployment = {} # construct your object here\r\nrequest = service.deployments().insert(body=deployment, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for deploymentmanager.deployments.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.deploymentmanager.v2\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.Deploymentmanager.v2;\r\nusing Google.Apis.Deploymentmanager.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DeploymentmanagerSample\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 deploymentmanagerService = new DeploymentmanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var deployment = new Deployment();\r\n // Add your code to populate the deployment object\r\n var call = deploymentmanagerService.Deployments.Insert(deployment, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/deploymentmanager.deployments.list.snippet.json b/deploymentmanager.deployments.list.snippet.json new file mode 100644 index 0000000..4a68870 --- /dev/null +++ b/deploymentmanager.deployments.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"deploymentmanager","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for deploymentmanager.deployments.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/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/deploymentmanager/v2/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.deploymentmanager.Deploymentmanager;\r\nimport com.google.api.services.deploymentmanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DeploymentmanagerSample {\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\tDeploymentmanager deploymentmanagerService = new Deploymentmanager.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\tDeploymentsListResponse response;\r\n\t\tDeploymentmanager.Deployments.List request = deploymentmanagerService.deployments().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getDeployments() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Deployment item : response.getDeployments()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for deploymentmanager.deployments.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/deploymentmanager/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 'deploymentmanager' service, at version 'v2'.\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('deploymentmanager', 'v2', credentials=credentials)\r\n\r\nrequest = service.deployments().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.deployments().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for deploymentmanager.deployments.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.deploymentmanager.v2\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.Deploymentmanager.v2;\r\nusing Google.Apis.Deploymentmanager.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DeploymentmanagerSample\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 deploymentmanagerService = new DeploymentmanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n DeploymentsListResponse response;\r\n var request = deploymentmanagerService.Deployments.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Deployments == null)\r\n continue;\r\n\r\n foreach (var item in response.Deployments)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/deploymentmanager.deployments.patch.snippet.json b/deploymentmanager.deployments.patch.snippet.json new file mode 100644 index 0000000..1fc0dbb --- /dev/null +++ b/deploymentmanager.deployments.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"deploymentmanager","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for deploymentmanager.deployments.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/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/deploymentmanager/v2/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.deploymentmanager.Deploymentmanager;\r\nimport com.google.api.services.deploymentmanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DeploymentmanagerSample {\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\tDeploymentmanager deploymentmanagerService = new Deploymentmanager.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\t// Obtain the Deployment object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tDeploymentmanager.Deployments.Patch request = deploymentmanagerService.deployments().patch(\"example-project\", \"example-deployment\", deployment);\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for deploymentmanager.deployments.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/deploymentmanager/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 'deploymentmanager' service, at version 'v2'.\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('deploymentmanager', 'v2', credentials=credentials)\r\n\r\n# Obtain the deployment object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.deployments().patch(body=deployment, project=\"example-project\", deployment=\"example-deployment\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for deploymentmanager.deployments.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.deploymentmanager.v2\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.Deploymentmanager.v2;\r\nusing Google.Apis.Deploymentmanager.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DeploymentmanagerSample\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 deploymentmanagerService = new DeploymentmanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the Deployment object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = deploymentmanagerService.Deployments.Patch(deployment, \"example-project\", \"example-deployment\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/deploymentmanager.deployments.stop.snippet.json b/deploymentmanager.deployments.stop.snippet.json new file mode 100644 index 0000000..7c27fe0 --- /dev/null +++ b/deploymentmanager.deployments.stop.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"deploymentmanager","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for deploymentmanager.deployments.stop\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/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/deploymentmanager/v2/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.deploymentmanager.Deploymentmanager;\r\nimport com.google.api.services.deploymentmanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DeploymentmanagerSample {\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\tDeploymentmanager deploymentmanagerService = new Deploymentmanager.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\tDeploymentsStopRequest deploymentsStopRequest = new DeploymentsStopRequest();\r\n\t\t// Add your code to populate the deploymentsStopRequest object\r\n\t\tDeploymentmanager.Deployments.Stop call = deploymentmanagerService.deployments().stop(\"example-project\", \"example-deployment\", deploymentsStopRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for deploymentmanager.deployments.stop\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/deploymentmanager/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 'deploymentmanager' service, at version 'v2'.\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('deploymentmanager', 'v2', credentials=credentials)\r\n\r\ndeployments_stop_request = {} # construct your object here\r\nrequest = service.deployments().stop(body=deployments_stop_request, project=\"example-project\", deployment=\"example-deployment\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for deploymentmanager.deployments.stop\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.deploymentmanager.v2\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.Deploymentmanager.v2;\r\nusing Google.Apis.Deploymentmanager.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DeploymentmanagerSample\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 deploymentmanagerService = new DeploymentmanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var deploymentsStopRequest = new DeploymentsStopRequest();\r\n // Add your code to populate the deploymentsStopRequest object\r\n var call = deploymentmanagerService.Deployments.Stop(deploymentsStopRequest, \"example-project\", \"example-deployment\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/deploymentmanager.deployments.update.snippet.json b/deploymentmanager.deployments.update.snippet.json new file mode 100644 index 0000000..048051e --- /dev/null +++ b/deploymentmanager.deployments.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"deploymentmanager","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for deploymentmanager.deployments.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/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/deploymentmanager/v2/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.deploymentmanager.Deploymentmanager;\r\nimport com.google.api.services.deploymentmanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DeploymentmanagerSample {\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\tDeploymentmanager deploymentmanagerService = new Deploymentmanager.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\tDeployment deployment = new Deployment();\r\n\t\t// Add your code to populate the deployment object\r\n\t\tDeploymentmanager.Deployments.Update call = deploymentmanagerService.deployments().update(\"example-project\", \"example-deployment\", deployment);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for deploymentmanager.deployments.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/deploymentmanager/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 'deploymentmanager' service, at version 'v2'.\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('deploymentmanager', 'v2', credentials=credentials)\r\n\r\ndeployment = {} # construct your object here\r\nrequest = service.deployments().update(body=deployment, project=\"example-project\", deployment=\"example-deployment\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for deploymentmanager.deployments.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.deploymentmanager.v2\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.Deploymentmanager.v2;\r\nusing Google.Apis.Deploymentmanager.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DeploymentmanagerSample\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 deploymentmanagerService = new DeploymentmanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var deployment = new Deployment();\r\n // Add your code to populate the deployment object\r\n var call = deploymentmanagerService.Deployments.Update(deployment, \"example-project\", \"example-deployment\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/deploymentmanager.manifests.get.snippet.json b/deploymentmanager.manifests.get.snippet.json new file mode 100644 index 0000000..3f7fb9b --- /dev/null +++ b/deploymentmanager.manifests.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"deploymentmanager","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for deploymentmanager.manifests.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/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/deploymentmanager/v2/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.deploymentmanager.Deploymentmanager;\r\nimport com.google.api.services.deploymentmanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DeploymentmanagerSample {\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\tDeploymentmanager deploymentmanagerService = new Deploymentmanager.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\tDeploymentmanager.Manifests.Get request = deploymentmanagerService.manifests().get(\"example-project\", \"example-deployment\", \"example-manifest\");\r\n\t\tManifest response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for deploymentmanager.manifests.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/deploymentmanager/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 'deploymentmanager' service, at version 'v2'.\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('deploymentmanager', 'v2', credentials=credentials)\r\n\r\nservice.manifests().get(project=\"example-project\", deployment=\"example-deployment\", manifest=\"example-manifest\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for deploymentmanager.manifests.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.deploymentmanager.v2\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.Deploymentmanager.v2;\r\nusing Google.Apis.Deploymentmanager.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DeploymentmanagerSample\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 deploymentmanagerService = new DeploymentmanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = deploymentmanagerService.Manifests.Get(\"example-project\", \"example-deployment\", \"example-manifest\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/deploymentmanager.manifests.list.snippet.json b/deploymentmanager.manifests.list.snippet.json new file mode 100644 index 0000000..dc4cf72 --- /dev/null +++ b/deploymentmanager.manifests.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"deploymentmanager","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for deploymentmanager.manifests.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/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/deploymentmanager/v2/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.deploymentmanager.Deploymentmanager;\r\nimport com.google.api.services.deploymentmanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DeploymentmanagerSample {\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\tDeploymentmanager deploymentmanagerService = new Deploymentmanager.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\tManifestsListResponse response;\r\n\t\tDeploymentmanager.Manifests.List request = deploymentmanagerService.manifests().list(\"example-project\", \"example-deployment\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getManifests() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Manifest item : response.getManifests()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for deploymentmanager.manifests.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/deploymentmanager/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 'deploymentmanager' service, at version 'v2'.\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('deploymentmanager', 'v2', credentials=credentials)\r\n\r\nrequest = service.manifests().list(project=\"example-project\", deployment=\"example-deployment\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.manifests().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for deploymentmanager.manifests.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.deploymentmanager.v2\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.Deploymentmanager.v2;\r\nusing Google.Apis.Deploymentmanager.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DeploymentmanagerSample\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 deploymentmanagerService = new DeploymentmanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ManifestsListResponse response;\r\n var request = deploymentmanagerService.Manifests.List(\"example-project\", \"example-deployment\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Manifests == null)\r\n continue;\r\n\r\n foreach (var item in response.Manifests)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/deploymentmanager.operations.get.snippet.json b/deploymentmanager.operations.get.snippet.json new file mode 100644 index 0000000..b17b849 --- /dev/null +++ b/deploymentmanager.operations.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"deploymentmanager","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for deploymentmanager.operations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/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/deploymentmanager/v2/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.deploymentmanager.Deploymentmanager;\r\nimport com.google.api.services.deploymentmanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DeploymentmanagerSample {\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\tDeploymentmanager deploymentmanagerService = new Deploymentmanager.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\tDeploymentmanager.Operations.Get request = deploymentmanagerService.operations().get(\"example-project\", \"example-operation\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for deploymentmanager.operations.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/deploymentmanager/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 'deploymentmanager' service, at version 'v2'.\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('deploymentmanager', 'v2', credentials=credentials)\r\n\r\nservice.operations().get(project=\"example-project\", operation=\"example-operation\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for deploymentmanager.operations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.deploymentmanager.v2\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.Deploymentmanager.v2;\r\nusing Google.Apis.Deploymentmanager.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DeploymentmanagerSample\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 deploymentmanagerService = new DeploymentmanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = deploymentmanagerService.Operations.Get(\"example-project\", \"example-operation\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/deploymentmanager.operations.list.snippet.json b/deploymentmanager.operations.list.snippet.json new file mode 100644 index 0000000..84384a4 --- /dev/null +++ b/deploymentmanager.operations.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"deploymentmanager","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for deploymentmanager.operations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/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/deploymentmanager/v2/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.deploymentmanager.Deploymentmanager;\r\nimport com.google.api.services.deploymentmanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DeploymentmanagerSample {\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\tDeploymentmanager deploymentmanagerService = new Deploymentmanager.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\tOperationsListResponse response;\r\n\t\tDeploymentmanager.Operations.List request = deploymentmanagerService.operations().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getOperations() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Operation item : response.getOperations()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for deploymentmanager.operations.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/deploymentmanager/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 'deploymentmanager' service, at version 'v2'.\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('deploymentmanager', 'v2', credentials=credentials)\r\n\r\nrequest = service.operations().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.operations().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for deploymentmanager.operations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.deploymentmanager.v2\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.Deploymentmanager.v2;\r\nusing Google.Apis.Deploymentmanager.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DeploymentmanagerSample\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 deploymentmanagerService = new DeploymentmanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n OperationsListResponse response;\r\n var request = deploymentmanagerService.Operations.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Operations == null)\r\n continue;\r\n\r\n foreach (var item in response.Operations)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/deploymentmanager.resources.get.snippet.json b/deploymentmanager.resources.get.snippet.json new file mode 100644 index 0000000..aedb21b --- /dev/null +++ b/deploymentmanager.resources.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"deploymentmanager","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for deploymentmanager.resources.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/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/deploymentmanager/v2/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.deploymentmanager.Deploymentmanager;\r\nimport com.google.api.services.deploymentmanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DeploymentmanagerSample {\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\tDeploymentmanager deploymentmanagerService = new Deploymentmanager.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\tDeploymentmanager.Resources.Get request = deploymentmanagerService.resources().get(\"example-project\", \"example-deployment\", \"example-resource\");\r\n\t\tResource response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for deploymentmanager.resources.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/deploymentmanager/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 'deploymentmanager' service, at version 'v2'.\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('deploymentmanager', 'v2', credentials=credentials)\r\n\r\nservice.resources().get(project=\"example-project\", deployment=\"example-deployment\", resource=\"example-resource\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for deploymentmanager.resources.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.deploymentmanager.v2\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.Deploymentmanager.v2;\r\nusing Google.Apis.Deploymentmanager.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DeploymentmanagerSample\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 deploymentmanagerService = new DeploymentmanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = deploymentmanagerService.Resources.Get(\"example-project\", \"example-deployment\", \"example-resource\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/deploymentmanager.resources.list.snippet.json b/deploymentmanager.resources.list.snippet.json new file mode 100644 index 0000000..24650d7 --- /dev/null +++ b/deploymentmanager.resources.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"deploymentmanager","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for deploymentmanager.resources.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/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/deploymentmanager/v2/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.deploymentmanager.Deploymentmanager;\r\nimport com.google.api.services.deploymentmanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DeploymentmanagerSample {\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\tDeploymentmanager deploymentmanagerService = new Deploymentmanager.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\tResourcesListResponse response;\r\n\t\tDeploymentmanager.Resources.List request = deploymentmanagerService.resources().list(\"example-project\", \"example-deployment\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getResources() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Resource item : response.getResources()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for deploymentmanager.resources.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/deploymentmanager/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 'deploymentmanager' service, at version 'v2'.\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('deploymentmanager', 'v2', credentials=credentials)\r\n\r\nrequest = service.resources().list(project=\"example-project\", deployment=\"example-deployment\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.resources().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for deploymentmanager.resources.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.deploymentmanager.v2\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.Deploymentmanager.v2;\r\nusing Google.Apis.Deploymentmanager.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DeploymentmanagerSample\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 deploymentmanagerService = new DeploymentmanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ResourcesListResponse response;\r\n var request = deploymentmanagerService.Resources.List(\"example-project\", \"example-deployment\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Resources == null)\r\n continue;\r\n\r\n foreach (var item in response.Resources)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/deploymentmanager.types.list.snippet.json b/deploymentmanager.types.list.snippet.json new file mode 100644 index 0000000..c7e44ea --- /dev/null +++ b/deploymentmanager.types.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"deploymentmanager","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for deploymentmanager.types.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/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/deploymentmanager/v2/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.deploymentmanager.Deploymentmanager;\r\nimport com.google.api.services.deploymentmanager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DeploymentmanagerSample {\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\tDeploymentmanager deploymentmanagerService = new Deploymentmanager.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\tTypesListResponse response;\r\n\t\tDeploymentmanager.Types.List request = deploymentmanagerService.types().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getTypes() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Type item : response.getTypes()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for deploymentmanager.types.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/deploymentmanager/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 'deploymentmanager' service, at version 'v2'.\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('deploymentmanager', 'v2', credentials=credentials)\r\n\r\nrequest = service.types().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.types().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for deploymentmanager.types.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable deploymentmanager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/deploymentmanager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.deploymentmanager.v2\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.Deploymentmanager.v2;\r\nusing Google.Apis.Deploymentmanager.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DeploymentmanagerSample\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 deploymentmanagerService = new DeploymentmanagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n TypesListResponse response;\r\n var request = deploymentmanagerService.Types.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Types == null)\r\n continue;\r\n\r\n foreach (var item in response.Types)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dns.changes.create.snippet.json b/dns.changes.create.snippet.json new file mode 100644 index 0000000..d876923 --- /dev/null +++ b/dns.changes.create.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dns","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dns.changes.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dns Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dns/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/dns/v1/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.dns.Dns;\r\nimport com.google.api.services.dns.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DnsSample {\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\tDns dnsService = new Dns.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\tChange change = new Change();\r\n\t\t// Add your code to populate the change object\r\n\t\tDns.Changes.Create call = dnsService.changes().create(\"example-project\", \"example-managedZone\", change);\r\n\t\tChange response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for dns.changes.create\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dns Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dns/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 'dns' service, at version 'v1'.\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('dns', 'v1', credentials=credentials)\r\n\r\nchange = {} # construct your object here\r\nrequest = service.changes().create(body=change, project=\"example-project\", managedZone=\"example-managedZone\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dns.changes.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dns Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dns/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dns.v1\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.Dns.v1;\r\nusing Google.Apis.Dns.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DnsSample\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 dnsService = new DnsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var change = new Change();\r\n // Add your code to populate the change object\r\n var call = dnsService.Changes.Create(change, \"example-project\", \"example-managedZone\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dns.changes.get.snippet.json b/dns.changes.get.snippet.json new file mode 100644 index 0000000..2467e5b --- /dev/null +++ b/dns.changes.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dns","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dns.changes.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dns Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dns/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/dns/v1/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.dns.Dns;\r\nimport com.google.api.services.dns.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DnsSample {\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\tDns dnsService = new Dns.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\tDns.Changes.Get request = dnsService.changes().get(\"example-project\", \"example-managedZone\", \"example-changeId\");\r\n\t\tChange response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for dns.changes.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dns Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dns/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 'dns' service, at version 'v1'.\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('dns', 'v1', credentials=credentials)\r\n\r\nservice.changes().get(project=\"example-project\", managedZone=\"example-managedZone\", changeId=\"example-changeId\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dns.changes.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dns Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dns/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dns.v1\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.Dns.v1;\r\nusing Google.Apis.Dns.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DnsSample\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 dnsService = new DnsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = dnsService.Changes.Get(\"example-project\", \"example-managedZone\", \"example-changeId\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dns.changes.list.snippet.json b/dns.changes.list.snippet.json new file mode 100644 index 0000000..2c1fb6c --- /dev/null +++ b/dns.changes.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dns","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dns.changes.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dns Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dns/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/dns/v1/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.dns.Dns;\r\nimport com.google.api.services.dns.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DnsSample {\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\tDns dnsService = new Dns.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\tChangesListResponse response;\r\n\t\tDns.Changes.List request = dnsService.changes().list(\"example-project\", \"example-managedZone\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getChanges() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Change item : response.getChanges()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for dns.changes.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dns Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dns/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 'dns' service, at version 'v1'.\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('dns', 'v1', credentials=credentials)\r\n\r\nrequest = service.changes().list(project=\"example-project\", managedZone=\"example-managedZone\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.changes().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dns.changes.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dns Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dns/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dns.v1\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.Dns.v1;\r\nusing Google.Apis.Dns.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DnsSample\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 dnsService = new DnsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ChangesListResponse response;\r\n var request = dnsService.Changes.List(\"example-project\", \"example-managedZone\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Changes == null)\r\n continue;\r\n\r\n foreach (var item in response.Changes)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dns.managedZones.create.snippet.json b/dns.managedZones.create.snippet.json new file mode 100644 index 0000000..61347cf --- /dev/null +++ b/dns.managedZones.create.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dns","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dns.managedZones.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dns Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dns/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/dns/v1/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.dns.Dns;\r\nimport com.google.api.services.dns.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DnsSample {\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\tDns dnsService = new Dns.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\tManagedZone managedZone = new ManagedZone();\r\n\t\t// Add your code to populate the managedZone object\r\n\t\tDns.ManagedZones.Create call = dnsService.managedZones().create(\"example-project\", managedZone);\r\n\t\tManagedZone response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for dns.managedZones.create\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dns Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dns/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 'dns' service, at version 'v1'.\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('dns', 'v1', credentials=credentials)\r\n\r\nmanaged_zone = {} # construct your object here\r\nrequest = service.managedZones().create(body=managed_zone, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dns.managedZones.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dns Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dns/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dns.v1\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.Dns.v1;\r\nusing Google.Apis.Dns.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DnsSample\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 dnsService = new DnsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var managedZone = new ManagedZone();\r\n // Add your code to populate the managedZone object\r\n var call = dnsService.ManagedZones.Create(managedZone, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dns.managedZones.delete.snippet.json b/dns.managedZones.delete.snippet.json new file mode 100644 index 0000000..d0ce875 --- /dev/null +++ b/dns.managedZones.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dns","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dns.managedZones.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dns Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dns/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/dns/v1/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.dns.Dns;\r\nimport com.google.api.services.dns.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DnsSample {\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\tDns dnsService = new Dns.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\tDns.ManagedZones.Delete request = dnsService.managedZones().delete(\"example-project\", \"example-managedZone\");\r\n\t\t response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for dns.managedZones.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dns Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dns/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 'dns' service, at version 'v1'.\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('dns', 'v1', credentials=credentials)\r\n\r\nservice.managedZones().delete(project=\"example-project\", managedZone=\"example-managedZone\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dns.managedZones.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dns Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dns/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dns.v1\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.Dns.v1;\r\nusing Google.Apis.Dns.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DnsSample\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 dnsService = new DnsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = dnsService.ManagedZones.Delete(\"example-project\", \"example-managedZone\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dns.managedZones.get.snippet.json b/dns.managedZones.get.snippet.json new file mode 100644 index 0000000..6b53ced --- /dev/null +++ b/dns.managedZones.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dns","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dns.managedZones.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dns Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dns/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/dns/v1/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.dns.Dns;\r\nimport com.google.api.services.dns.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DnsSample {\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\tDns dnsService = new Dns.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\tDns.ManagedZones.Get request = dnsService.managedZones().get(\"example-project\", \"example-managedZone\");\r\n\t\tManagedZone response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for dns.managedZones.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dns Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dns/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 'dns' service, at version 'v1'.\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('dns', 'v1', credentials=credentials)\r\n\r\nservice.managedZones().get(project=\"example-project\", managedZone=\"example-managedZone\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dns.managedZones.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dns Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dns/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dns.v1\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.Dns.v1;\r\nusing Google.Apis.Dns.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DnsSample\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 dnsService = new DnsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = dnsService.ManagedZones.Get(\"example-project\", \"example-managedZone\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dns.managedZones.list.snippet.json b/dns.managedZones.list.snippet.json new file mode 100644 index 0000000..941c348 --- /dev/null +++ b/dns.managedZones.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dns","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dns.managedZones.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dns Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dns/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/dns/v1/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.dns.Dns;\r\nimport com.google.api.services.dns.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DnsSample {\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\tDns dnsService = new Dns.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\tManagedZonesListResponse response;\r\n\t\tDns.ManagedZones.List request = dnsService.managedZones().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getManagedZones() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (ManagedZone item : response.getManagedZones()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for dns.managedZones.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dns Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dns/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 'dns' service, at version 'v1'.\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('dns', 'v1', credentials=credentials)\r\n\r\nrequest = service.managedZones().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.managedZones().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dns.managedZones.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dns Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dns/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dns.v1\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.Dns.v1;\r\nusing Google.Apis.Dns.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DnsSample\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 dnsService = new DnsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ManagedZonesListResponse response;\r\n var request = dnsService.ManagedZones.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.ManagedZones == null)\r\n continue;\r\n\r\n foreach (var item in response.ManagedZones)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dns.projects.get.snippet.json b/dns.projects.get.snippet.json new file mode 100644 index 0000000..061e5bd --- /dev/null +++ b/dns.projects.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dns","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dns.projects.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dns Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dns/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/dns/v1/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.dns.Dns;\r\nimport com.google.api.services.dns.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DnsSample {\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\tDns dnsService = new Dns.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\tDns.Projects.Get request = dnsService.projects().get(\"example-project\");\r\n\t\tProject response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for dns.projects.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dns Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dns/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 'dns' service, at version 'v1'.\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('dns', 'v1', credentials=credentials)\r\n\r\nservice.projects().get(project=\"example-project\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dns.projects.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dns Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dns/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dns.v1\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.Dns.v1;\r\nusing Google.Apis.Dns.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DnsSample\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 dnsService = new DnsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = dnsService.Projects.Get(\"example-project\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/dns.resourceRecordSets.list.snippet.json b/dns.resourceRecordSets.list.snippet.json new file mode 100644 index 0000000..1c893a3 --- /dev/null +++ b/dns.resourceRecordSets.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"dns","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for dns.resourceRecordSets.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dns Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dns/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/dns/v1/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.dns.Dns;\r\nimport com.google.api.services.dns.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class DnsSample {\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\tDns dnsService = new Dns.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\tResourceRecordSetsListResponse response;\r\n\t\tDns.ResourceRecordSets.List request = dnsService.resourceRecordSets().list(\"example-project\", \"example-managedZone\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getRrsets() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (ResourceRecordSet item : response.getRrsets()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for dns.resourceRecordSets.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable dns Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/dns/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 'dns' service, at version 'v1'.\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('dns', 'v1', credentials=credentials)\r\n\r\nrequest = service.resourceRecordSets().list(project=\"example-project\", managedZone=\"example-managedZone\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.resourceRecordSets().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for dns.resourceRecordSets.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable dns Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/dns/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.dns.v1\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.Dns.v1;\r\nusing Google.Apis.Dns.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass DnsSample\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 dnsService = new DnsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ResourceRecordSetsListResponse response;\r\n var request = dnsService.ResourceRecordSets.List(\"example-project\", \"example-managedZone\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Rrsets == null)\r\n continue;\r\n\r\n foreach (var item in response.Rrsets)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/iam.projects.serviceAccounts.create.snippet.json b/iam.projects.serviceAccounts.create.snippet.json new file mode 100644 index 0000000..db2682e --- /dev/null +++ b/iam.projects.serviceAccounts.create.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"iam","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for iam.projects.serviceAccounts.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/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/iam/v1/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.iam.Iam;\r\nimport com.google.api.services.iam.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class IamSample {\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\tIam iamService = new Iam.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\tCreateServiceAccountRequest createServiceAccountRequest = new CreateServiceAccountRequest();\r\n\t\t// Add your code to populate the createServiceAccountRequest object\r\n\t\tIam.Projects.ServiceAccounts.Create call = iamService.projects().serviceAccounts().create(\"projects/example-project\", createServiceAccountRequest);\r\n\t\tServiceAccount response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for iam.projects.serviceAccounts.create\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable iam Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/iam/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 'iam' service, at version 'v1'.\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('iam', 'v1', credentials=credentials)\r\n\r\ncreate_service_account_request = {} # construct your object here\r\nrequest = service.projects().serviceAccounts().create(body=create_service_account_request, name=\"projects/example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for iam.projects.serviceAccounts.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.iam.v1\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.Iam.v1;\r\nusing Google.Apis.Iam.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass IamSample\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 iamService = new IamService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var createServiceAccountRequest = new CreateServiceAccountRequest();\r\n // Add your code to populate the createServiceAccountRequest object\r\n var call = iamService.Projects.ServiceAccounts.Create(createServiceAccountRequest, \"projects/example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/iam.projects.serviceAccounts.delete.snippet.json b/iam.projects.serviceAccounts.delete.snippet.json new file mode 100644 index 0000000..6b724a8 --- /dev/null +++ b/iam.projects.serviceAccounts.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"iam","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for iam.projects.serviceAccounts.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/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/iam/v1/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.iam.Iam;\r\nimport com.google.api.services.iam.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class IamSample {\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\tIam iamService = new Iam.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\tIam.Projects.ServiceAccounts.Delete request = iamService.projects().serviceAccounts().delete(\"projects/example-project/serviceAccounts/example-serviceAccount\");\r\n\t\tEmpty response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for iam.projects.serviceAccounts.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable iam Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/iam/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 'iam' service, at version 'v1'.\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('iam', 'v1', credentials=credentials)\r\n\r\nservice.projects().serviceAccounts().delete(name=\"projects/example-project/serviceAccounts/example-serviceAccount\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for iam.projects.serviceAccounts.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.iam.v1\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.Iam.v1;\r\nusing Google.Apis.Iam.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass IamSample\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 iamService = new IamService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = iamService.Projects.ServiceAccounts.Delete(\"projects/example-project/serviceAccounts/example-serviceAccount\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/iam.projects.serviceAccounts.get.snippet.json b/iam.projects.serviceAccounts.get.snippet.json new file mode 100644 index 0000000..98916fa --- /dev/null +++ b/iam.projects.serviceAccounts.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"iam","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for iam.projects.serviceAccounts.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/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/iam/v1/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.iam.Iam;\r\nimport com.google.api.services.iam.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class IamSample {\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\tIam iamService = new Iam.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\tIam.Projects.ServiceAccounts.Get request = iamService.projects().serviceAccounts().get(\"projects/example-project/serviceAccounts/example-serviceAccount\");\r\n\t\tServiceAccount response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for iam.projects.serviceAccounts.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable iam Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/iam/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 'iam' service, at version 'v1'.\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('iam', 'v1', credentials=credentials)\r\n\r\nservice.projects().serviceAccounts().get(name=\"projects/example-project/serviceAccounts/example-serviceAccount\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for iam.projects.serviceAccounts.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.iam.v1\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.Iam.v1;\r\nusing Google.Apis.Iam.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass IamSample\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 iamService = new IamService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = iamService.Projects.ServiceAccounts.Get(\"projects/example-project/serviceAccounts/example-serviceAccount\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/iam.projects.serviceAccounts.getIamPolicy.snippet.json b/iam.projects.serviceAccounts.getIamPolicy.snippet.json new file mode 100644 index 0000000..f869e64 --- /dev/null +++ b/iam.projects.serviceAccounts.getIamPolicy.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"iam","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for iam.projects.serviceAccounts.getIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/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/iam/v1/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.iam.Iam;\r\nimport com.google.api.services.iam.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class IamSample {\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\tIam iamService = new Iam.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\tIam.Projects.ServiceAccounts.GetIamPolicy request = iamService.projects().serviceAccounts().getIamPolicy(\"projects/example-project/serviceAccounts/example-serviceAccount\");\r\n\t\tPolicy response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for iam.projects.serviceAccounts.getIamPolicy\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable iam Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/iam/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 'iam' service, at version 'v1'.\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('iam', 'v1', credentials=credentials)\r\n\r\nservice.projects().serviceAccounts().getIamPolicy(resource=\"projects/example-project/serviceAccounts/example-serviceAccount\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for iam.projects.serviceAccounts.getIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.iam.v1\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.Iam.v1;\r\nusing Google.Apis.Iam.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass IamSample\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 iamService = new IamService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = iamService.Projects.ServiceAccounts.GetIamPolicy(\"projects/example-project/serviceAccounts/example-serviceAccount\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/iam.projects.serviceAccounts.keys.create.snippet.json b/iam.projects.serviceAccounts.keys.create.snippet.json new file mode 100644 index 0000000..6b86dda --- /dev/null +++ b/iam.projects.serviceAccounts.keys.create.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"iam","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for iam.projects.serviceAccounts.keys.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/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/iam/v1/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.iam.Iam;\r\nimport com.google.api.services.iam.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class IamSample {\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\tIam iamService = new Iam.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\tCreateServiceAccountKeyRequest createServiceAccountKeyRequest = new CreateServiceAccountKeyRequest();\r\n\t\t// Add your code to populate the createServiceAccountKeyRequest object\r\n\t\tIam.Projects.ServiceAccounts.Keys.Create call = iamService.projects().serviceAccounts().keys().create(\"projects/example-project/serviceAccounts/example-serviceAccount\", createServiceAccountKeyRequest);\r\n\t\tServiceAccountKey response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for iam.projects.serviceAccounts.keys.create\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable iam Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/iam/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 'iam' service, at version 'v1'.\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('iam', 'v1', credentials=credentials)\r\n\r\ncreate_service_account_key_request = {} # construct your object here\r\nrequest = service.projects().serviceAccounts().keys().create(body=create_service_account_key_request, name=\"projects/example-project/serviceAccounts/example-serviceAccount\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for iam.projects.serviceAccounts.keys.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.iam.v1\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.Iam.v1;\r\nusing Google.Apis.Iam.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass IamSample\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 iamService = new IamService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var createServiceAccountKeyRequest = new CreateServiceAccountKeyRequest();\r\n // Add your code to populate the createServiceAccountKeyRequest object\r\n var call = iamService.Projects.ServiceAccounts.Keys.Create(createServiceAccountKeyRequest, \"projects/example-project/serviceAccounts/example-serviceAccount\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/iam.projects.serviceAccounts.keys.delete.snippet.json b/iam.projects.serviceAccounts.keys.delete.snippet.json new file mode 100644 index 0000000..5245ec8 --- /dev/null +++ b/iam.projects.serviceAccounts.keys.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"iam","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for iam.projects.serviceAccounts.keys.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/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/iam/v1/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.iam.Iam;\r\nimport com.google.api.services.iam.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class IamSample {\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\tIam iamService = new Iam.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\tIam.Projects.ServiceAccounts.Keys.Delete request = iamService.projects().serviceAccounts().keys().delete(\"projects/example-project/serviceAccounts/example-serviceAccount/keys/example-key\");\r\n\t\tEmpty response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for iam.projects.serviceAccounts.keys.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable iam Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/iam/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 'iam' service, at version 'v1'.\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('iam', 'v1', credentials=credentials)\r\n\r\nservice.projects().serviceAccounts().keys().delete(name=\"projects/example-project/serviceAccounts/example-serviceAccount/keys/example-key\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for iam.projects.serviceAccounts.keys.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.iam.v1\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.Iam.v1;\r\nusing Google.Apis.Iam.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass IamSample\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 iamService = new IamService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = iamService.Projects.ServiceAccounts.Keys.Delete(\"projects/example-project/serviceAccounts/example-serviceAccount/keys/example-key\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/iam.projects.serviceAccounts.keys.get.snippet.json b/iam.projects.serviceAccounts.keys.get.snippet.json new file mode 100644 index 0000000..62bf8d4 --- /dev/null +++ b/iam.projects.serviceAccounts.keys.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"iam","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for iam.projects.serviceAccounts.keys.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/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/iam/v1/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.iam.Iam;\r\nimport com.google.api.services.iam.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class IamSample {\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\tIam iamService = new Iam.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\tIam.Projects.ServiceAccounts.Keys.Get request = iamService.projects().serviceAccounts().keys().get(\"projects/example-project/serviceAccounts/example-serviceAccount/keys/example-key\");\r\n\t\tServiceAccountKey response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for iam.projects.serviceAccounts.keys.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable iam Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/iam/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 'iam' service, at version 'v1'.\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('iam', 'v1', credentials=credentials)\r\n\r\nservice.projects().serviceAccounts().keys().get(name=\"projects/example-project/serviceAccounts/example-serviceAccount/keys/example-key\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for iam.projects.serviceAccounts.keys.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.iam.v1\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.Iam.v1;\r\nusing Google.Apis.Iam.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass IamSample\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 iamService = new IamService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = iamService.Projects.ServiceAccounts.Keys.Get(\"projects/example-project/serviceAccounts/example-serviceAccount/keys/example-key\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/iam.projects.serviceAccounts.keys.list.snippet.json b/iam.projects.serviceAccounts.keys.list.snippet.json new file mode 100644 index 0000000..68f8cf8 --- /dev/null +++ b/iam.projects.serviceAccounts.keys.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"iam","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for iam.projects.serviceAccounts.keys.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/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/iam/v1/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.iam.Iam;\r\nimport com.google.api.services.iam.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class IamSample {\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\tIam iamService = new Iam.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\tIam.Projects.ServiceAccounts.Keys.List request = iamService.projects().serviceAccounts().keys().list(\"projects/example-project/serviceAccounts/example-serviceAccount\");\r\n\t\tListServiceAccountKeysResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for iam.projects.serviceAccounts.keys.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable iam Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/iam/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 'iam' service, at version 'v1'.\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('iam', 'v1', credentials=credentials)\r\n\r\nservice.projects().serviceAccounts().keys().list(name=\"projects/example-project/serviceAccounts/example-serviceAccount\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for iam.projects.serviceAccounts.keys.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.iam.v1\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.Iam.v1;\r\nusing Google.Apis.Iam.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass IamSample\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 iamService = new IamService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = iamService.Projects.ServiceAccounts.Keys.List(\"projects/example-project/serviceAccounts/example-serviceAccount\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/iam.projects.serviceAccounts.list.snippet.json b/iam.projects.serviceAccounts.list.snippet.json new file mode 100644 index 0000000..45a9390 --- /dev/null +++ b/iam.projects.serviceAccounts.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"iam","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for iam.projects.serviceAccounts.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/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/iam/v1/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.iam.Iam;\r\nimport com.google.api.services.iam.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class IamSample {\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\tIam iamService = new Iam.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\tListServiceAccountsResponse response;\r\n\t\tIam.Projects.ServiceAccounts.List request = iamService.projects().serviceAccounts().list(\"projects/example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getAccounts() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (ServiceAccount item : response.getAccounts()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for iam.projects.serviceAccounts.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable iam Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/iam/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 'iam' service, at version 'v1'.\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('iam', 'v1', credentials=credentials)\r\n\r\nrequest = service.projects().serviceAccounts().list(name=\"projects/example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.projects().serviceAccounts().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for iam.projects.serviceAccounts.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.iam.v1\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.Iam.v1;\r\nusing Google.Apis.Iam.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass IamSample\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 iamService = new IamService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListServiceAccountsResponse response;\r\n var request = iamService.Projects.ServiceAccounts.List(\"projects/example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Accounts == null)\r\n continue;\r\n\r\n foreach (var item in response.Accounts)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/iam.projects.serviceAccounts.setIamPolicy.snippet.json b/iam.projects.serviceAccounts.setIamPolicy.snippet.json new file mode 100644 index 0000000..97ac9c6 --- /dev/null +++ b/iam.projects.serviceAccounts.setIamPolicy.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"iam","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for iam.projects.serviceAccounts.setIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/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/iam/v1/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.iam.Iam;\r\nimport com.google.api.services.iam.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class IamSample {\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\tIam iamService = new Iam.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\tSetIamPolicyRequest setIamPolicyRequest = new SetIamPolicyRequest();\r\n\t\t// Add your code to populate the setIamPolicyRequest object\r\n\t\tIam.Projects.ServiceAccounts.SetIamPolicy call = iamService.projects().serviceAccounts().setIamPolicy(\"projects/example-project/serviceAccounts/example-serviceAccount\", setIamPolicyRequest);\r\n\t\tPolicy response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for iam.projects.serviceAccounts.setIamPolicy\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable iam Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/iam/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 'iam' service, at version 'v1'.\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('iam', 'v1', credentials=credentials)\r\n\r\nset_iam_policy_request = {} # construct your object here\r\nrequest = service.projects().serviceAccounts().setIamPolicy(body=set_iam_policy_request, resource=\"projects/example-project/serviceAccounts/example-serviceAccount\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for iam.projects.serviceAccounts.setIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.iam.v1\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.Iam.v1;\r\nusing Google.Apis.Iam.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass IamSample\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 iamService = new IamService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var setIamPolicyRequest = new SetIamPolicyRequest();\r\n // Add your code to populate the setIamPolicyRequest object\r\n var call = iamService.Projects.ServiceAccounts.SetIamPolicy(setIamPolicyRequest, \"projects/example-project/serviceAccounts/example-serviceAccount\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/iam.projects.serviceAccounts.signBlob.snippet.json b/iam.projects.serviceAccounts.signBlob.snippet.json new file mode 100644 index 0000000..fe1dcf5 --- /dev/null +++ b/iam.projects.serviceAccounts.signBlob.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"iam","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for iam.projects.serviceAccounts.signBlob\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/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/iam/v1/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.iam.Iam;\r\nimport com.google.api.services.iam.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class IamSample {\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\tIam iamService = new Iam.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\tSignBlobRequest signBlobRequest = new SignBlobRequest();\r\n\t\t// Add your code to populate the signBlobRequest object\r\n\t\tIam.Projects.ServiceAccounts.SignBlob call = iamService.projects().serviceAccounts().signBlob(\"projects/example-project/serviceAccounts/example-serviceAccount\", signBlobRequest);\r\n\t\tSignBlobResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for iam.projects.serviceAccounts.signBlob\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable iam Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/iam/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 'iam' service, at version 'v1'.\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('iam', 'v1', credentials=credentials)\r\n\r\nsign_blob_request = {} # construct your object here\r\nrequest = service.projects().serviceAccounts().signBlob(body=sign_blob_request, name=\"projects/example-project/serviceAccounts/example-serviceAccount\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for iam.projects.serviceAccounts.signBlob\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.iam.v1\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.Iam.v1;\r\nusing Google.Apis.Iam.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass IamSample\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 iamService = new IamService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var signBlobRequest = new SignBlobRequest();\r\n // Add your code to populate the signBlobRequest object\r\n var call = iamService.Projects.ServiceAccounts.SignBlob(signBlobRequest, \"projects/example-project/serviceAccounts/example-serviceAccount\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/iam.projects.serviceAccounts.testIamPermissions.snippet.json b/iam.projects.serviceAccounts.testIamPermissions.snippet.json new file mode 100644 index 0000000..919688d --- /dev/null +++ b/iam.projects.serviceAccounts.testIamPermissions.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"iam","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for iam.projects.serviceAccounts.testIamPermissions\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/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/iam/v1/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.iam.Iam;\r\nimport com.google.api.services.iam.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class IamSample {\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\tIam iamService = new Iam.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\tTestIamPermissionsRequest testIamPermissionsRequest = new TestIamPermissionsRequest();\r\n\t\t// Add your code to populate the testIamPermissionsRequest object\r\n\t\tIam.Projects.ServiceAccounts.TestIamPermissions call = iamService.projects().serviceAccounts().testIamPermissions(\"projects/example-project/serviceAccounts/example-serviceAccount\", testIamPermissionsRequest);\r\n\t\tTestIamPermissionsResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for iam.projects.serviceAccounts.testIamPermissions\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable iam Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/iam/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 'iam' service, at version 'v1'.\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('iam', 'v1', credentials=credentials)\r\n\r\ntest_iam_permissions_request = {} # construct your object here\r\nrequest = service.projects().serviceAccounts().testIamPermissions(body=test_iam_permissions_request, resource=\"projects/example-project/serviceAccounts/example-serviceAccount\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for iam.projects.serviceAccounts.testIamPermissions\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.iam.v1\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.Iam.v1;\r\nusing Google.Apis.Iam.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass IamSample\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 iamService = new IamService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var testIamPermissionsRequest = new TestIamPermissionsRequest();\r\n // Add your code to populate the testIamPermissionsRequest object\r\n var call = iamService.Projects.ServiceAccounts.TestIamPermissions(testIamPermissionsRequest, \"projects/example-project/serviceAccounts/example-serviceAccount\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/iam.projects.serviceAccounts.update.snippet.json b/iam.projects.serviceAccounts.update.snippet.json new file mode 100644 index 0000000..2d06cc8 --- /dev/null +++ b/iam.projects.serviceAccounts.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"iam","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for iam.projects.serviceAccounts.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/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/iam/v1/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.iam.Iam;\r\nimport com.google.api.services.iam.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class IamSample {\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\tIam iamService = new Iam.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\tServiceAccount serviceAccount = new ServiceAccount();\r\n\t\t// Add your code to populate the serviceAccount object\r\n\t\tIam.Projects.ServiceAccounts.Update call = iamService.projects().serviceAccounts().update(\"projects/example-project/serviceAccounts/example-serviceAccount\", serviceAccount);\r\n\t\tServiceAccount response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for iam.projects.serviceAccounts.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable iam Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/iam/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 'iam' service, at version 'v1'.\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('iam', 'v1', credentials=credentials)\r\n\r\nservice_account = {} # construct your object here\r\nrequest = service.projects().serviceAccounts().update(body=service_account, name=\"projects/example-project/serviceAccounts/example-serviceAccount\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for iam.projects.serviceAccounts.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable iam Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/iam/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.iam.v1\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.Iam.v1;\r\nusing Google.Apis.Iam.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass IamSample\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 iamService = new IamService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var serviceAccount = new ServiceAccount();\r\n // Add your code to populate the serviceAccount object\r\n var call = iamService.Projects.ServiceAccounts.Update(serviceAccount, \"projects/example-project/serviceAccounts/example-serviceAccount\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/language.detections.list.snippet.json b/language.detections.list.snippet.json new file mode 100644 index 0000000..9f6ff50 --- /dev/null +++ b/language.detections.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"translate","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for language.detections.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable translate Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/translate/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/translate/v2/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.translate.Translate;\r\nimport com.google.api.services.translate.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class TranslateSample {\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\tTranslate translateService = new Translate.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\tTranslate.Detections.List request = translateService.detections().list(\"example-q\");\r\n\t\tDetectionsListResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for language.detections.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable translate Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/translate/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 'translate' service, at version 'v2'.\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('translate', 'v2', credentials=credentials)\r\n\r\nservice.detections().list(q=\"example-q\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for language.detections.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable translate Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/translate/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.translate.v2\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.Translate.v2;\r\nusing Google.Apis.Translate.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass TranslateSample\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 translateService = new TranslateService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = translateService.Detections.List(\"example-q\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/language.languages.list.snippet.json b/language.languages.list.snippet.json new file mode 100644 index 0000000..949153e --- /dev/null +++ b/language.languages.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"translate","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for language.languages.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable translate Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/translate/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/translate/v2/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.translate.Translate;\r\nimport com.google.api.services.translate.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class TranslateSample {\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\tTranslate translateService = new Translate.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\tTranslate.Languages.List request = translateService.languages().list();\r\n\t\tLanguagesListResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for language.languages.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable translate Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/translate/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 'translate' service, at version 'v2'.\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('translate', 'v2', credentials=credentials)\r\n\r\nservice.languages().list().execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for language.languages.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable translate Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/translate/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.translate.v2\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.Translate.v2;\r\nusing Google.Apis.Translate.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass TranslateSample\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 translateService = new TranslateService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = translateService.Languages.List();\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/language.translations.list.snippet.json b/language.translations.list.snippet.json new file mode 100644 index 0000000..8b057c5 --- /dev/null +++ b/language.translations.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"translate","apiVersion":"v2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for language.translations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable translate Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/translate/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/translate/v2/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.translate.Translate;\r\nimport com.google.api.services.translate.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class TranslateSample {\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\tTranslate translateService = new Translate.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\tTranslate.Translations.List request = translateService.translations().list(\"example-q\", \"example-target\");\r\n\t\tTranslationsListResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for language.translations.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable translate Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/translate/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 'translate' service, at version 'v2'.\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('translate', 'v2', credentials=credentials)\r\n\r\nservice.translations().list(q=\"example-q\", target=\"example-target\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for language.translations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable translate Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/translate/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.translate.v2\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.Translate.v2;\r\nusing Google.Apis.Translate.v2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass TranslateSample\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 translateService = new TranslateService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = translateService.Translations.List(\"example-q\", \"example-target\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/logging.entries.list.snippet.json b/logging.entries.list.snippet.json new file mode 100644 index 0000000..610aec5 --- /dev/null +++ b/logging.entries.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"logging","apiVersion":"v2beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for logging.entries.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/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/logging/v2beta1/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.logging.Logging;\r\nimport com.google.api.services.logging.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class LoggingSample {\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\tLogging loggingService = new Logging.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\tListLogEntriesRequest listLogEntriesRequest = new ListLogEntriesRequest();\r\n\t\t// Add your code to populate the listLogEntriesRequest object\r\n\t\tLogging.Entries.List call = loggingService.entries().list(listLogEntriesRequest);\r\n\t\tListLogEntriesResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for logging.entries.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable logging Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/logging/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 'logging' service, at version 'v2beta1'.\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('logging', 'v2beta1', credentials=credentials)\r\n\r\nlist_log_entries_request = {} # construct your object here\r\nrequest = service.entries().list(body=list_log_entries_request)\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for logging.entries.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.logging.v2beta1\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.Logging.v2beta1;\r\nusing Google.Apis.Logging.v2beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass LoggingSample\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 loggingService = new LoggingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var listLogEntriesRequest = new ListLogEntriesRequest();\r\n // Add your code to populate the listLogEntriesRequest object\r\n var call = loggingService.Entries.List(listLogEntriesRequest);\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/logging.entries.write.snippet.json b/logging.entries.write.snippet.json new file mode 100644 index 0000000..ae8642a --- /dev/null +++ b/logging.entries.write.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"logging","apiVersion":"v2beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for logging.entries.write\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/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/logging/v2beta1/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.logging.Logging;\r\nimport com.google.api.services.logging.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class LoggingSample {\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\tLogging loggingService = new Logging.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\tWriteLogEntriesRequest writeLogEntriesRequest = new WriteLogEntriesRequest();\r\n\t\t// Add your code to populate the writeLogEntriesRequest object\r\n\t\tLogging.Entries.Write call = loggingService.entries().write(writeLogEntriesRequest);\r\n\t\tWriteLogEntriesResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for logging.entries.write\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable logging Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/logging/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 'logging' service, at version 'v2beta1'.\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('logging', 'v2beta1', credentials=credentials)\r\n\r\nwrite_log_entries_request = {} # construct your object here\r\nrequest = service.entries().write(body=write_log_entries_request)\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for logging.entries.write\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.logging.v2beta1\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.Logging.v2beta1;\r\nusing Google.Apis.Logging.v2beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass LoggingSample\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 loggingService = new LoggingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var writeLogEntriesRequest = new WriteLogEntriesRequest();\r\n // Add your code to populate the writeLogEntriesRequest object\r\n var call = loggingService.Entries.Write(writeLogEntriesRequest);\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/logging.monitoredResourceDescriptors.list.snippet.json b/logging.monitoredResourceDescriptors.list.snippet.json new file mode 100644 index 0000000..be93e88 --- /dev/null +++ b/logging.monitoredResourceDescriptors.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"logging","apiVersion":"v2beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for logging.monitoredResourceDescriptors.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/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/logging/v2beta1/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.logging.Logging;\r\nimport com.google.api.services.logging.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class LoggingSample {\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\tLogging loggingService = new Logging.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\tListMonitoredResourceDescriptorsResponse response;\r\n\t\tLogging.MonitoredResourceDescriptors.List request = loggingService.monitoredResourceDescriptors().list();\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getResourceDescriptors() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (MonitoredResourceDescriptor item : response.getResourceDescriptors()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for logging.monitoredResourceDescriptors.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable logging Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/logging/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 'logging' service, at version 'v2beta1'.\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('logging', 'v2beta1', credentials=credentials)\r\n\r\nrequest = service.monitoredResourceDescriptors().list()\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.monitoredResourceDescriptors().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for logging.monitoredResourceDescriptors.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.logging.v2beta1\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.Logging.v2beta1;\r\nusing Google.Apis.Logging.v2beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass LoggingSample\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 loggingService = new LoggingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListMonitoredResourceDescriptorsResponse response;\r\n var request = loggingService.MonitoredResourceDescriptors.List();\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.ResourceDescriptors == null)\r\n continue;\r\n\r\n foreach (var item in response.ResourceDescriptors)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/logging.projects.logs.delete.snippet.json b/logging.projects.logs.delete.snippet.json new file mode 100644 index 0000000..952a638 --- /dev/null +++ b/logging.projects.logs.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"logging","apiVersion":"v2beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for logging.projects.logs.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/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/logging/v2beta1/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.logging.Logging;\r\nimport com.google.api.services.logging.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class LoggingSample {\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\tLogging loggingService = new Logging.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\tLogging.Projects.Logs.Delete request = loggingService.projects().logs().delete(\"projects/example-project/logs/example-log\");\r\n\t\tEmpty response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for logging.projects.logs.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable logging Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/logging/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 'logging' service, at version 'v2beta1'.\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('logging', 'v2beta1', credentials=credentials)\r\n\r\nservice.projects().logs().delete(logName=\"projects/example-project/logs/example-log\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for logging.projects.logs.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.logging.v2beta1\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.Logging.v2beta1;\r\nusing Google.Apis.Logging.v2beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass LoggingSample\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 loggingService = new LoggingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = loggingService.Projects.Logs.Delete(\"projects/example-project/logs/example-log\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/logging.projects.metrics.create.snippet.json b/logging.projects.metrics.create.snippet.json new file mode 100644 index 0000000..783a4d9 --- /dev/null +++ b/logging.projects.metrics.create.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"logging","apiVersion":"v2beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for logging.projects.metrics.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/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/logging/v2beta1/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.logging.Logging;\r\nimport com.google.api.services.logging.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class LoggingSample {\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\tLogging loggingService = new Logging.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\tLogMetric logMetric = new LogMetric();\r\n\t\t// Add your code to populate the logMetric object\r\n\t\tLogging.Projects.Metrics.Create call = loggingService.projects().metrics().create(\"example-project\", logMetric);\r\n\t\tLogMetric response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for logging.projects.metrics.create\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable logging Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/logging/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 'logging' service, at version 'v2beta1'.\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('logging', 'v2beta1', credentials=credentials)\r\n\r\nlog_metric = {} # construct your object here\r\nrequest = service.projects().metrics().create(body=log_metric, projectName=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for logging.projects.metrics.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.logging.v2beta1\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.Logging.v2beta1;\r\nusing Google.Apis.Logging.v2beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass LoggingSample\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 loggingService = new LoggingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var logMetric = new LogMetric();\r\n // Add your code to populate the logMetric object\r\n var call = loggingService.Projects.Metrics.Create(logMetric, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/logging.projects.metrics.delete.snippet.json b/logging.projects.metrics.delete.snippet.json new file mode 100644 index 0000000..11a937b --- /dev/null +++ b/logging.projects.metrics.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"logging","apiVersion":"v2beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for logging.projects.metrics.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/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/logging/v2beta1/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.logging.Logging;\r\nimport com.google.api.services.logging.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class LoggingSample {\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\tLogging loggingService = new Logging.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\tLogging.Projects.Metrics.Delete request = loggingService.projects().metrics().delete(\"projects/example-project/metrics/example-metric\");\r\n\t\tEmpty response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for logging.projects.metrics.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable logging Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/logging/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 'logging' service, at version 'v2beta1'.\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('logging', 'v2beta1', credentials=credentials)\r\n\r\nservice.projects().metrics().delete(metricName=\"projects/example-project/metrics/example-metric\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for logging.projects.metrics.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.logging.v2beta1\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.Logging.v2beta1;\r\nusing Google.Apis.Logging.v2beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass LoggingSample\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 loggingService = new LoggingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = loggingService.Projects.Metrics.Delete(\"projects/example-project/metrics/example-metric\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/logging.projects.metrics.get.snippet.json b/logging.projects.metrics.get.snippet.json new file mode 100644 index 0000000..14226bb --- /dev/null +++ b/logging.projects.metrics.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"logging","apiVersion":"v2beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for logging.projects.metrics.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/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/logging/v2beta1/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.logging.Logging;\r\nimport com.google.api.services.logging.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class LoggingSample {\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\tLogging loggingService = new Logging.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\tLogging.Projects.Metrics.Get request = loggingService.projects().metrics().get(\"projects/example-project/metrics/example-metric\");\r\n\t\tLogMetric response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for logging.projects.metrics.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable logging Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/logging/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 'logging' service, at version 'v2beta1'.\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('logging', 'v2beta1', credentials=credentials)\r\n\r\nservice.projects().metrics().get(metricName=\"projects/example-project/metrics/example-metric\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for logging.projects.metrics.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.logging.v2beta1\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.Logging.v2beta1;\r\nusing Google.Apis.Logging.v2beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass LoggingSample\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 loggingService = new LoggingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = loggingService.Projects.Metrics.Get(\"projects/example-project/metrics/example-metric\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/logging.projects.metrics.list.snippet.json b/logging.projects.metrics.list.snippet.json new file mode 100644 index 0000000..9e9e01d --- /dev/null +++ b/logging.projects.metrics.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"logging","apiVersion":"v2beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for logging.projects.metrics.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/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/logging/v2beta1/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.logging.Logging;\r\nimport com.google.api.services.logging.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class LoggingSample {\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\tLogging loggingService = new Logging.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\tListLogMetricsResponse response;\r\n\t\tLogging.Projects.Metrics.List request = loggingService.projects().metrics().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getMetrics() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (LogMetric item : response.getMetrics()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for logging.projects.metrics.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable logging Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/logging/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 'logging' service, at version 'v2beta1'.\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('logging', 'v2beta1', credentials=credentials)\r\n\r\nrequest = service.projects().metrics().list(projectName=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.projects().metrics().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for logging.projects.metrics.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.logging.v2beta1\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.Logging.v2beta1;\r\nusing Google.Apis.Logging.v2beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass LoggingSample\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 loggingService = new LoggingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListLogMetricsResponse response;\r\n var request = loggingService.Projects.Metrics.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Metrics == null)\r\n continue;\r\n\r\n foreach (var item in response.Metrics)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/logging.projects.metrics.update.snippet.json b/logging.projects.metrics.update.snippet.json new file mode 100644 index 0000000..21c72be --- /dev/null +++ b/logging.projects.metrics.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"logging","apiVersion":"v2beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for logging.projects.metrics.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/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/logging/v2beta1/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.logging.Logging;\r\nimport com.google.api.services.logging.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class LoggingSample {\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\tLogging loggingService = new Logging.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\tLogMetric logMetric = new LogMetric();\r\n\t\t// Add your code to populate the logMetric object\r\n\t\tLogging.Projects.Metrics.Update call = loggingService.projects().metrics().update(\"projects/example-project/metrics/example-metric\", logMetric);\r\n\t\tLogMetric response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for logging.projects.metrics.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable logging Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/logging/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 'logging' service, at version 'v2beta1'.\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('logging', 'v2beta1', credentials=credentials)\r\n\r\nlog_metric = {} # construct your object here\r\nrequest = service.projects().metrics().update(body=log_metric, metricName=\"projects/example-project/metrics/example-metric\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for logging.projects.metrics.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.logging.v2beta1\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.Logging.v2beta1;\r\nusing Google.Apis.Logging.v2beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass LoggingSample\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 loggingService = new LoggingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var logMetric = new LogMetric();\r\n // Add your code to populate the logMetric object\r\n var call = loggingService.Projects.Metrics.Update(logMetric, \"projects/example-project/metrics/example-metric\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/logging.projects.sinks.create.snippet.json b/logging.projects.sinks.create.snippet.json new file mode 100644 index 0000000..6f114f7 --- /dev/null +++ b/logging.projects.sinks.create.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"logging","apiVersion":"v2beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for logging.projects.sinks.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/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/logging/v2beta1/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.logging.Logging;\r\nimport com.google.api.services.logging.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class LoggingSample {\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\tLogging loggingService = new Logging.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\tLogSink logSink = new LogSink();\r\n\t\t// Add your code to populate the logSink object\r\n\t\tLogging.Projects.Sinks.Create call = loggingService.projects().sinks().create(\"example-project\", logSink);\r\n\t\tLogSink response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for logging.projects.sinks.create\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable logging Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/logging/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 'logging' service, at version 'v2beta1'.\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('logging', 'v2beta1', credentials=credentials)\r\n\r\nlog_sink = {} # construct your object here\r\nrequest = service.projects().sinks().create(body=log_sink, projectName=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for logging.projects.sinks.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.logging.v2beta1\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.Logging.v2beta1;\r\nusing Google.Apis.Logging.v2beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass LoggingSample\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 loggingService = new LoggingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var logSink = new LogSink();\r\n // Add your code to populate the logSink object\r\n var call = loggingService.Projects.Sinks.Create(logSink, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/logging.projects.sinks.delete.snippet.json b/logging.projects.sinks.delete.snippet.json new file mode 100644 index 0000000..6eccb18 --- /dev/null +++ b/logging.projects.sinks.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"logging","apiVersion":"v2beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for logging.projects.sinks.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/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/logging/v2beta1/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.logging.Logging;\r\nimport com.google.api.services.logging.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class LoggingSample {\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\tLogging loggingService = new Logging.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\tLogging.Projects.Sinks.Delete request = loggingService.projects().sinks().delete(\"projects/example-project/sinks/example-sink\");\r\n\t\tEmpty response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for logging.projects.sinks.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable logging Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/logging/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 'logging' service, at version 'v2beta1'.\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('logging', 'v2beta1', credentials=credentials)\r\n\r\nservice.projects().sinks().delete(sinkName=\"projects/example-project/sinks/example-sink\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for logging.projects.sinks.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.logging.v2beta1\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.Logging.v2beta1;\r\nusing Google.Apis.Logging.v2beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass LoggingSample\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 loggingService = new LoggingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = loggingService.Projects.Sinks.Delete(\"projects/example-project/sinks/example-sink\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/logging.projects.sinks.get.snippet.json b/logging.projects.sinks.get.snippet.json new file mode 100644 index 0000000..ec7d71d --- /dev/null +++ b/logging.projects.sinks.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"logging","apiVersion":"v2beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for logging.projects.sinks.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/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/logging/v2beta1/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.logging.Logging;\r\nimport com.google.api.services.logging.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class LoggingSample {\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\tLogging loggingService = new Logging.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\tLogging.Projects.Sinks.Get request = loggingService.projects().sinks().get(\"projects/example-project/sinks/example-sink\");\r\n\t\tLogSink response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for logging.projects.sinks.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable logging Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/logging/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 'logging' service, at version 'v2beta1'.\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('logging', 'v2beta1', credentials=credentials)\r\n\r\nservice.projects().sinks().get(sinkName=\"projects/example-project/sinks/example-sink\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for logging.projects.sinks.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.logging.v2beta1\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.Logging.v2beta1;\r\nusing Google.Apis.Logging.v2beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass LoggingSample\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 loggingService = new LoggingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = loggingService.Projects.Sinks.Get(\"projects/example-project/sinks/example-sink\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/logging.projects.sinks.list.snippet.json b/logging.projects.sinks.list.snippet.json new file mode 100644 index 0000000..e09a2e7 --- /dev/null +++ b/logging.projects.sinks.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"logging","apiVersion":"v2beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for logging.projects.sinks.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/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/logging/v2beta1/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.logging.Logging;\r\nimport com.google.api.services.logging.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class LoggingSample {\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\tLogging loggingService = new Logging.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\tListSinksResponse response;\r\n\t\tLogging.Projects.Sinks.List request = loggingService.projects().sinks().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getSinks() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (LogSink item : response.getSinks()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for logging.projects.sinks.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable logging Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/logging/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 'logging' service, at version 'v2beta1'.\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('logging', 'v2beta1', credentials=credentials)\r\n\r\nrequest = service.projects().sinks().list(projectName=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.projects().sinks().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for logging.projects.sinks.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.logging.v2beta1\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.Logging.v2beta1;\r\nusing Google.Apis.Logging.v2beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass LoggingSample\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 loggingService = new LoggingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListSinksResponse response;\r\n var request = loggingService.Projects.Sinks.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Sinks == null)\r\n continue;\r\n\r\n foreach (var item in response.Sinks)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/logging.projects.sinks.update.snippet.json b/logging.projects.sinks.update.snippet.json new file mode 100644 index 0000000..b8fdfc6 --- /dev/null +++ b/logging.projects.sinks.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"logging","apiVersion":"v2beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for logging.projects.sinks.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/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/logging/v2beta1/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.logging.Logging;\r\nimport com.google.api.services.logging.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class LoggingSample {\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\tLogging loggingService = new Logging.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\tLogSink logSink = new LogSink();\r\n\t\t// Add your code to populate the logSink object\r\n\t\tLogging.Projects.Sinks.Update call = loggingService.projects().sinks().update(\"projects/example-project/sinks/example-sink\", logSink);\r\n\t\tLogSink response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for logging.projects.sinks.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable logging Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/logging/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 'logging' service, at version 'v2beta1'.\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('logging', 'v2beta1', credentials=credentials)\r\n\r\nlog_sink = {} # construct your object here\r\nrequest = service.projects().sinks().update(body=log_sink, sinkName=\"projects/example-project/sinks/example-sink\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for logging.projects.sinks.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable logging Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/logging/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.logging.v2beta1\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.Logging.v2beta1;\r\nusing Google.Apis.Logging.v2beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass LoggingSample\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 loggingService = new LoggingService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var logSink = new LogSink();\r\n // Add your code to populate the logSink object\r\n var call = loggingService.Projects.Sinks.Update(logSink, \"projects/example-project/sinks/example-sink\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/manager.deployments.delete.snippet.json b/manager.deployments.delete.snippet.json new file mode 100644 index 0000000..640bfa0 --- /dev/null +++ b/manager.deployments.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"manager","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for manager.deployments.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable manager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/manager/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/manager/v1beta2/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.manager.Manager;\r\nimport com.google.api.services.manager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ManagerSample {\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\tManager managerService = new Manager.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\tManager.Deployments.Delete request = managerService.deployments().delete(\"example-project\", \"example-region\", \"example-deploymentName\");\r\n\t\t response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for manager.deployments.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable manager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/manager/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 'manager' service, at version 'v1beta2'.\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('manager', 'v1beta2', credentials=credentials)\r\n\r\nservice.deployments().delete(projectId=\"example-project\", region=\"example-region\", deploymentName=\"example-deploymentName\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for manager.deployments.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable manager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/manager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.manager.v1beta2\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.Manager.v1beta2;\r\nusing Google.Apis.Manager.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ManagerSample\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 managerService = new ManagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = managerService.Deployments.Delete(\"example-project\", \"example-region\", \"example-deploymentName\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/manager.deployments.get.snippet.json b/manager.deployments.get.snippet.json new file mode 100644 index 0000000..c44ca5c --- /dev/null +++ b/manager.deployments.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"manager","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for manager.deployments.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable manager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/manager/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/manager/v1beta2/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.manager.Manager;\r\nimport com.google.api.services.manager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ManagerSample {\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\tManager managerService = new Manager.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\tManager.Deployments.Get request = managerService.deployments().get(\"example-project\", \"example-region\", \"example-deploymentName\");\r\n\t\tDeployment response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for manager.deployments.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable manager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/manager/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 'manager' service, at version 'v1beta2'.\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('manager', 'v1beta2', credentials=credentials)\r\n\r\nservice.deployments().get(projectId=\"example-project\", region=\"example-region\", deploymentName=\"example-deploymentName\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for manager.deployments.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable manager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/manager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.manager.v1beta2\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.Manager.v1beta2;\r\nusing Google.Apis.Manager.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ManagerSample\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 managerService = new ManagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = managerService.Deployments.Get(\"example-project\", \"example-region\", \"example-deploymentName\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/manager.deployments.insert.snippet.json b/manager.deployments.insert.snippet.json new file mode 100644 index 0000000..65522a9 --- /dev/null +++ b/manager.deployments.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"manager","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for manager.deployments.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable manager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/manager/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/manager/v1beta2/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.manager.Manager;\r\nimport com.google.api.services.manager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ManagerSample {\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\tManager managerService = new Manager.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\tDeployment deployment = new Deployment();\r\n\t\t// Add your code to populate the deployment object\r\n\t\tManager.Deployments.Insert call = managerService.deployments().insert(\"example-project\", \"example-region\", deployment);\r\n\t\tDeployment response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for manager.deployments.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable manager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/manager/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 'manager' service, at version 'v1beta2'.\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('manager', 'v1beta2', credentials=credentials)\r\n\r\ndeployment = {} # construct your object here\r\nrequest = service.deployments().insert(body=deployment, projectId=\"example-project\", region=\"example-region\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for manager.deployments.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable manager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/manager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.manager.v1beta2\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.Manager.v1beta2;\r\nusing Google.Apis.Manager.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ManagerSample\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 managerService = new ManagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var deployment = new Deployment();\r\n // Add your code to populate the deployment object\r\n var call = managerService.Deployments.Insert(deployment, \"example-project\", \"example-region\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/manager.deployments.list.snippet.json b/manager.deployments.list.snippet.json new file mode 100644 index 0000000..422bdc4 --- /dev/null +++ b/manager.deployments.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"manager","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for manager.deployments.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable manager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/manager/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/manager/v1beta2/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.manager.Manager;\r\nimport com.google.api.services.manager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ManagerSample {\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\tManager managerService = new Manager.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\tDeploymentsListResponse response;\r\n\t\tManager.Deployments.List request = managerService.deployments().list(\"example-project\", \"example-region\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getResources() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Deployment item : response.getResources()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for manager.deployments.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable manager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/manager/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 'manager' service, at version 'v1beta2'.\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('manager', 'v1beta2', credentials=credentials)\r\n\r\nrequest = service.deployments().list(projectId=\"example-project\", region=\"example-region\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.deployments().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for manager.deployments.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable manager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/manager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.manager.v1beta2\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.Manager.v1beta2;\r\nusing Google.Apis.Manager.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ManagerSample\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 managerService = new ManagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n DeploymentsListResponse response;\r\n var request = managerService.Deployments.List(\"example-project\", \"example-region\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Resources == null)\r\n continue;\r\n\r\n foreach (var item in response.Resources)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/manager.templates.delete.snippet.json b/manager.templates.delete.snippet.json new file mode 100644 index 0000000..47ab2b1 --- /dev/null +++ b/manager.templates.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"manager","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for manager.templates.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable manager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/manager/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/manager/v1beta2/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.manager.Manager;\r\nimport com.google.api.services.manager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ManagerSample {\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\tManager managerService = new Manager.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\tManager.Templates.Delete request = managerService.templates().delete(\"example-project\", \"example-templateName\");\r\n\t\t response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for manager.templates.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable manager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/manager/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 'manager' service, at version 'v1beta2'.\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('manager', 'v1beta2', credentials=credentials)\r\n\r\nservice.templates().delete(projectId=\"example-project\", templateName=\"example-templateName\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for manager.templates.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable manager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/manager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.manager.v1beta2\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.Manager.v1beta2;\r\nusing Google.Apis.Manager.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ManagerSample\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 managerService = new ManagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = managerService.Templates.Delete(\"example-project\", \"example-templateName\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/manager.templates.get.snippet.json b/manager.templates.get.snippet.json new file mode 100644 index 0000000..aad9116 --- /dev/null +++ b/manager.templates.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"manager","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for manager.templates.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable manager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/manager/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/manager/v1beta2/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.manager.Manager;\r\nimport com.google.api.services.manager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ManagerSample {\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\tManager managerService = new Manager.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\tManager.Templates.Get request = managerService.templates().get(\"example-project\", \"example-templateName\");\r\n\t\tTemplate response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for manager.templates.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable manager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/manager/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 'manager' service, at version 'v1beta2'.\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('manager', 'v1beta2', credentials=credentials)\r\n\r\nservice.templates().get(projectId=\"example-project\", templateName=\"example-templateName\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for manager.templates.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable manager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/manager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.manager.v1beta2\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.Manager.v1beta2;\r\nusing Google.Apis.Manager.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ManagerSample\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 managerService = new ManagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = managerService.Templates.Get(\"example-project\", \"example-templateName\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/manager.templates.insert.snippet.json b/manager.templates.insert.snippet.json new file mode 100644 index 0000000..54dcb29 --- /dev/null +++ b/manager.templates.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"manager","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for manager.templates.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable manager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/manager/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/manager/v1beta2/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.manager.Manager;\r\nimport com.google.api.services.manager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ManagerSample {\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\tManager managerService = new Manager.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\tTemplate template = new Template();\r\n\t\t// Add your code to populate the template object\r\n\t\tManager.Templates.Insert call = managerService.templates().insert(\"example-project\", template);\r\n\t\tTemplate response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for manager.templates.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable manager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/manager/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 'manager' service, at version 'v1beta2'.\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('manager', 'v1beta2', credentials=credentials)\r\n\r\ntemplate = {} # construct your object here\r\nrequest = service.templates().insert(body=template, projectId=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for manager.templates.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable manager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/manager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.manager.v1beta2\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.Manager.v1beta2;\r\nusing Google.Apis.Manager.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ManagerSample\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 managerService = new ManagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var template = new Template();\r\n // Add your code to populate the template object\r\n var call = managerService.Templates.Insert(template, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/manager.templates.list.snippet.json b/manager.templates.list.snippet.json new file mode 100644 index 0000000..70b0179 --- /dev/null +++ b/manager.templates.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"manager","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for manager.templates.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable manager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/manager/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/manager/v1beta2/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.manager.Manager;\r\nimport com.google.api.services.manager.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ManagerSample {\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\tManager managerService = new Manager.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\tTemplatesListResponse response;\r\n\t\tManager.Templates.List request = managerService.templates().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getResources() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Template item : response.getResources()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for manager.templates.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable manager Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/manager/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 'manager' service, at version 'v1beta2'.\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('manager', 'v1beta2', credentials=credentials)\r\n\r\nrequest = service.templates().list(projectId=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.templates().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for manager.templates.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable manager Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/manager/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.manager.v1beta2\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.Manager.v1beta2;\r\nusing Google.Apis.Manager.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ManagerSample\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 managerService = new ManagerService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n TemplatesListResponse response;\r\n var request = managerService.Templates.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Resources == null)\r\n continue;\r\n\r\n foreach (var item in response.Resources)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/prediction.hostedmodels.predict.snippet.json b/prediction.hostedmodels.predict.snippet.json new file mode 100644 index 0000000..2f0d993 --- /dev/null +++ b/prediction.hostedmodels.predict.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"prediction","apiVersion":"v1.6","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for prediction.hostedmodels.predict\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable prediction Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/prediction/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/prediction/v1.6/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.prediction.Prediction;\r\nimport com.google.api.services.prediction.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PredictionSample {\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\tPrediction predictionService = new Prediction.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\tInput input = new Input();\r\n\t\t// Add your code to populate the input object\r\n\t\tPrediction.Hostedmodels.Predict call = predictionService.hostedmodels().predict(\"example-project\", \"example-hostedModelName\", input);\r\n\t\tOutput response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for prediction.hostedmodels.predict\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable prediction Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/prediction/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 'prediction' service, at version 'v1.6'.\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('prediction', 'v1.6', credentials=credentials)\r\n\r\ninput = {} # construct your object here\r\nrequest = service.hostedmodels().predict(body=input, project=\"example-project\", hostedModelName=\"example-hostedModelName\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for prediction.hostedmodels.predict\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable prediction Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/prediction/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.prediction.v1.6\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.Prediction.v1.6;\r\nusing Google.Apis.Prediction.v1.6.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PredictionSample\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 predictionService = new PredictionService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var input = new Input();\r\n // Add your code to populate the input object\r\n var call = predictionService.Hostedmodels.Predict(input, \"example-project\", \"example-hostedModelName\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/prediction.trainedmodels.analyze.snippet.json b/prediction.trainedmodels.analyze.snippet.json new file mode 100644 index 0000000..7a4b6d0 --- /dev/null +++ b/prediction.trainedmodels.analyze.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"prediction","apiVersion":"v1.6","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for prediction.trainedmodels.analyze\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable prediction Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/prediction/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/prediction/v1.6/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.prediction.Prediction;\r\nimport com.google.api.services.prediction.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PredictionSample {\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\tPrediction predictionService = new Prediction.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\tPrediction.Trainedmodels.Analyze request = predictionService.trainedmodels().analyze(\"example-project\", \"example-id\");\r\n\t\tAnalyze response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for prediction.trainedmodels.analyze\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable prediction Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/prediction/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 'prediction' service, at version 'v1.6'.\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('prediction', 'v1.6', credentials=credentials)\r\n\r\nservice.trainedmodels().analyze(project=\"example-project\", id=\"example-id\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for prediction.trainedmodels.analyze\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable prediction Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/prediction/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.prediction.v1.6\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.Prediction.v1.6;\r\nusing Google.Apis.Prediction.v1.6.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PredictionSample\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 predictionService = new PredictionService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = predictionService.Trainedmodels.Analyze(\"example-project\", \"example-id\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/prediction.trainedmodels.delete.snippet.json b/prediction.trainedmodels.delete.snippet.json new file mode 100644 index 0000000..e92e3b7 --- /dev/null +++ b/prediction.trainedmodels.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"prediction","apiVersion":"v1.6","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for prediction.trainedmodels.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable prediction Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/prediction/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/prediction/v1.6/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.prediction.Prediction;\r\nimport com.google.api.services.prediction.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PredictionSample {\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\tPrediction predictionService = new Prediction.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\tPrediction.Trainedmodels.Delete request = predictionService.trainedmodels().delete(\"example-project\", \"example-id\");\r\n\t\t response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for prediction.trainedmodels.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable prediction Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/prediction/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 'prediction' service, at version 'v1.6'.\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('prediction', 'v1.6', credentials=credentials)\r\n\r\nservice.trainedmodels().delete(project=\"example-project\", id=\"example-id\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for prediction.trainedmodels.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable prediction Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/prediction/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.prediction.v1.6\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.Prediction.v1.6;\r\nusing Google.Apis.Prediction.v1.6.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PredictionSample\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 predictionService = new PredictionService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = predictionService.Trainedmodels.Delete(\"example-project\", \"example-id\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/prediction.trainedmodels.get.snippet.json b/prediction.trainedmodels.get.snippet.json new file mode 100644 index 0000000..71424bc --- /dev/null +++ b/prediction.trainedmodels.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"prediction","apiVersion":"v1.6","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for prediction.trainedmodels.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable prediction Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/prediction/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/prediction/v1.6/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.prediction.Prediction;\r\nimport com.google.api.services.prediction.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PredictionSample {\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\tPrediction predictionService = new Prediction.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\tPrediction.Trainedmodels.Get request = predictionService.trainedmodels().get(\"example-project\", \"example-id\");\r\n\t\tInsert2 response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for prediction.trainedmodels.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable prediction Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/prediction/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 'prediction' service, at version 'v1.6'.\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('prediction', 'v1.6', credentials=credentials)\r\n\r\nservice.trainedmodels().get(project=\"example-project\", id=\"example-id\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for prediction.trainedmodels.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable prediction Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/prediction/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.prediction.v1.6\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.Prediction.v1.6;\r\nusing Google.Apis.Prediction.v1.6.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PredictionSample\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 predictionService = new PredictionService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = predictionService.Trainedmodels.Get(\"example-project\", \"example-id\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/prediction.trainedmodels.insert.snippet.json b/prediction.trainedmodels.insert.snippet.json new file mode 100644 index 0000000..464d007 --- /dev/null +++ b/prediction.trainedmodels.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"prediction","apiVersion":"v1.6","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for prediction.trainedmodels.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable prediction Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/prediction/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/prediction/v1.6/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.prediction.Prediction;\r\nimport com.google.api.services.prediction.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PredictionSample {\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\tPrediction predictionService = new Prediction.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\tInsert insert = new Insert();\r\n\t\t// Add your code to populate the insert object\r\n\t\tPrediction.Trainedmodels.Insert call = predictionService.trainedmodels().insert(\"example-project\", insert);\r\n\t\tInsert2 response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for prediction.trainedmodels.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable prediction Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/prediction/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 'prediction' service, at version 'v1.6'.\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('prediction', 'v1.6', credentials=credentials)\r\n\r\ninsert = {} # construct your object here\r\nrequest = service.trainedmodels().insert(body=insert, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for prediction.trainedmodels.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable prediction Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/prediction/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.prediction.v1.6\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.Prediction.v1.6;\r\nusing Google.Apis.Prediction.v1.6.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PredictionSample\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 predictionService = new PredictionService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var insert = new Insert();\r\n // Add your code to populate the insert object\r\n var call = predictionService.Trainedmodels.Insert(insert, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/prediction.trainedmodels.list.snippet.json b/prediction.trainedmodels.list.snippet.json new file mode 100644 index 0000000..30e2de1 --- /dev/null +++ b/prediction.trainedmodels.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"prediction","apiVersion":"v1.6","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for prediction.trainedmodels.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable prediction Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/prediction/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/prediction/v1.6/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.prediction.Prediction;\r\nimport com.google.api.services.prediction.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PredictionSample {\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\tPrediction predictionService = new Prediction.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\tList response;\r\n\t\tPrediction.Trainedmodels.List request = predictionService.trainedmodels().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Insert2 item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for prediction.trainedmodels.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable prediction Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/prediction/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 'prediction' service, at version 'v1.6'.\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('prediction', 'v1.6', credentials=credentials)\r\n\r\nrequest = service.trainedmodels().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.trainedmodels().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for prediction.trainedmodels.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable prediction Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/prediction/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.prediction.v1.6\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.Prediction.v1.6;\r\nusing Google.Apis.Prediction.v1.6.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PredictionSample\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 predictionService = new PredictionService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n List response;\r\n var request = predictionService.Trainedmodels.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/prediction.trainedmodels.predict.snippet.json b/prediction.trainedmodels.predict.snippet.json new file mode 100644 index 0000000..ca44bdf --- /dev/null +++ b/prediction.trainedmodels.predict.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"prediction","apiVersion":"v1.6","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for prediction.trainedmodels.predict\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable prediction Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/prediction/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/prediction/v1.6/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.prediction.Prediction;\r\nimport com.google.api.services.prediction.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PredictionSample {\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\tPrediction predictionService = new Prediction.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\tInput input = new Input();\r\n\t\t// Add your code to populate the input object\r\n\t\tPrediction.Trainedmodels.Predict call = predictionService.trainedmodels().predict(\"example-project\", \"example-id\", input);\r\n\t\tOutput response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for prediction.trainedmodels.predict\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable prediction Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/prediction/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 'prediction' service, at version 'v1.6'.\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('prediction', 'v1.6', credentials=credentials)\r\n\r\ninput = {} # construct your object here\r\nrequest = service.trainedmodels().predict(body=input, project=\"example-project\", id=\"example-id\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for prediction.trainedmodels.predict\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable prediction Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/prediction/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.prediction.v1.6\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.Prediction.v1.6;\r\nusing Google.Apis.Prediction.v1.6.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PredictionSample\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 predictionService = new PredictionService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var input = new Input();\r\n // Add your code to populate the input object\r\n var call = predictionService.Trainedmodels.Predict(input, \"example-project\", \"example-id\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/prediction.trainedmodels.update.snippet.json b/prediction.trainedmodels.update.snippet.json new file mode 100644 index 0000000..a8aa682 --- /dev/null +++ b/prediction.trainedmodels.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"prediction","apiVersion":"v1.6","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for prediction.trainedmodels.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable prediction Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/prediction/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/prediction/v1.6/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.prediction.Prediction;\r\nimport com.google.api.services.prediction.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PredictionSample {\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\tPrediction predictionService = new Prediction.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\tUpdate update = new Update();\r\n\t\t// Add your code to populate the update object\r\n\t\tPrediction.Trainedmodels.Update call = predictionService.trainedmodels().update(\"example-project\", \"example-id\", update);\r\n\t\tInsert2 response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for prediction.trainedmodels.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable prediction Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/prediction/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 'prediction' service, at version 'v1.6'.\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('prediction', 'v1.6', credentials=credentials)\r\n\r\nupdate = {} # construct your object here\r\nrequest = service.trainedmodels().update(body=update, project=\"example-project\", id=\"example-id\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for prediction.trainedmodels.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable prediction Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/prediction/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.prediction.v1.6\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.Prediction.v1.6;\r\nusing Google.Apis.Prediction.v1.6.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PredictionSample\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 predictionService = new PredictionService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var update = new Update();\r\n // Add your code to populate the update object\r\n var call = predictionService.Trainedmodels.Update(update, \"example-project\", \"example-id\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.subscriptions.acknowledge.snippet.json b/pubsub.projects.subscriptions.acknowledge.snippet.json new file mode 100644 index 0000000..374a8ff --- /dev/null +++ b/pubsub.projects.subscriptions.acknowledge.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.subscriptions.acknowledge\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tAcknowledgeRequest acknowledgeRequest = new AcknowledgeRequest();\r\n\t\t// Add your code to populate the acknowledgeRequest object\r\n\t\tPubsub.Projects.Subscriptions.Acknowledge call = pubsubService.projects().subscriptions().acknowledge(\"projects/example-project/subscriptions/example-subscription\", acknowledgeRequest);\r\n\t\tEmpty response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.subscriptions.acknowledge\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\nacknowledge_request = {} # construct your object here\r\nrequest = service.projects().subscriptions().acknowledge(body=acknowledge_request, subscription=\"projects/example-project/subscriptions/example-subscription\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.subscriptions.acknowledge\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var acknowledgeRequest = new AcknowledgeRequest();\r\n // Add your code to populate the acknowledgeRequest object\r\n var call = pubsubService.Projects.Subscriptions.Acknowledge(acknowledgeRequest, \"projects/example-project/subscriptions/example-subscription\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.subscriptions.create.snippet.json b/pubsub.projects.subscriptions.create.snippet.json new file mode 100644 index 0000000..ee74f1f --- /dev/null +++ b/pubsub.projects.subscriptions.create.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.subscriptions.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tSubscription subscription = new Subscription();\r\n\t\t// Add your code to populate the subscription object\r\n\t\tPubsub.Projects.Subscriptions.Create call = pubsubService.projects().subscriptions().create(\"projects/example-project/subscriptions/example-subscription\", subscription);\r\n\t\tSubscription response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.subscriptions.create\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\nsubscription = {} # construct your object here\r\nrequest = service.projects().subscriptions().create(body=subscription, name=\"projects/example-project/subscriptions/example-subscription\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.subscriptions.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var subscription = new Subscription();\r\n // Add your code to populate the subscription object\r\n var call = pubsubService.Projects.Subscriptions.Create(subscription, \"projects/example-project/subscriptions/example-subscription\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.subscriptions.delete.snippet.json b/pubsub.projects.subscriptions.delete.snippet.json new file mode 100644 index 0000000..3731129 --- /dev/null +++ b/pubsub.projects.subscriptions.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.subscriptions.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tPubsub.Projects.Subscriptions.Delete request = pubsubService.projects().subscriptions().delete(\"projects/example-project/subscriptions/example-subscription\");\r\n\t\tEmpty response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.subscriptions.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\nservice.projects().subscriptions().delete(subscription=\"projects/example-project/subscriptions/example-subscription\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.subscriptions.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = pubsubService.Projects.Subscriptions.Delete(\"projects/example-project/subscriptions/example-subscription\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.subscriptions.get.snippet.json b/pubsub.projects.subscriptions.get.snippet.json new file mode 100644 index 0000000..763db9e --- /dev/null +++ b/pubsub.projects.subscriptions.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.subscriptions.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tPubsub.Projects.Subscriptions.Get request = pubsubService.projects().subscriptions().get(\"projects/example-project/subscriptions/example-subscription\");\r\n\t\tSubscription response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.subscriptions.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\nservice.projects().subscriptions().get(subscription=\"projects/example-project/subscriptions/example-subscription\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.subscriptions.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = pubsubService.Projects.Subscriptions.Get(\"projects/example-project/subscriptions/example-subscription\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.subscriptions.getIamPolicy.snippet.json b/pubsub.projects.subscriptions.getIamPolicy.snippet.json new file mode 100644 index 0000000..d250cfd --- /dev/null +++ b/pubsub.projects.subscriptions.getIamPolicy.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.subscriptions.getIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tPubsub.Projects.Subscriptions.GetIamPolicy request = pubsubService.projects().subscriptions().getIamPolicy(\"projects/example-project/subscriptions/example-subscription\");\r\n\t\tPolicy response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.subscriptions.getIamPolicy\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\nservice.projects().subscriptions().getIamPolicy(resource=\"projects/example-project/subscriptions/example-subscription\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.subscriptions.getIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = pubsubService.Projects.Subscriptions.GetIamPolicy(\"projects/example-project/subscriptions/example-subscription\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.subscriptions.list.snippet.json b/pubsub.projects.subscriptions.list.snippet.json new file mode 100644 index 0000000..669a41e --- /dev/null +++ b/pubsub.projects.subscriptions.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.subscriptions.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tListSubscriptionsResponse response;\r\n\t\tPubsub.Projects.Subscriptions.List request = pubsubService.projects().subscriptions().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getSubscriptions() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Subscription item : response.getSubscriptions()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.subscriptions.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\nrequest = service.projects().subscriptions().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.projects().subscriptions().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.subscriptions.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListSubscriptionsResponse response;\r\n var request = pubsubService.Projects.Subscriptions.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Subscriptions == null)\r\n continue;\r\n\r\n foreach (var item in response.Subscriptions)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.subscriptions.modifyAckDeadline.snippet.json b/pubsub.projects.subscriptions.modifyAckDeadline.snippet.json new file mode 100644 index 0000000..4baaa7a --- /dev/null +++ b/pubsub.projects.subscriptions.modifyAckDeadline.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.subscriptions.modifyAckDeadline\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tModifyAckDeadlineRequest modifyAckDeadlineRequest = new ModifyAckDeadlineRequest();\r\n\t\t// Add your code to populate the modifyAckDeadlineRequest object\r\n\t\tPubsub.Projects.Subscriptions.ModifyAckDeadline call = pubsubService.projects().subscriptions().modifyAckDeadline(\"projects/example-project/subscriptions/example-subscription\", modifyAckDeadlineRequest);\r\n\t\tEmpty response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.subscriptions.modifyAckDeadline\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\nmodify_ack_deadline_request = {} # construct your object here\r\nrequest = service.projects().subscriptions().modifyAckDeadline(body=modify_ack_deadline_request, subscription=\"projects/example-project/subscriptions/example-subscription\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.subscriptions.modifyAckDeadline\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var modifyAckDeadlineRequest = new ModifyAckDeadlineRequest();\r\n // Add your code to populate the modifyAckDeadlineRequest object\r\n var call = pubsubService.Projects.Subscriptions.ModifyAckDeadline(modifyAckDeadlineRequest, \"projects/example-project/subscriptions/example-subscription\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.subscriptions.modifyPushConfig.snippet.json b/pubsub.projects.subscriptions.modifyPushConfig.snippet.json new file mode 100644 index 0000000..4f964a1 --- /dev/null +++ b/pubsub.projects.subscriptions.modifyPushConfig.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.subscriptions.modifyPushConfig\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tModifyPushConfigRequest modifyPushConfigRequest = new ModifyPushConfigRequest();\r\n\t\t// Add your code to populate the modifyPushConfigRequest object\r\n\t\tPubsub.Projects.Subscriptions.ModifyPushConfig call = pubsubService.projects().subscriptions().modifyPushConfig(\"projects/example-project/subscriptions/example-subscription\", modifyPushConfigRequest);\r\n\t\tEmpty response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.subscriptions.modifyPushConfig\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\nmodify_push_config_request = {} # construct your object here\r\nrequest = service.projects().subscriptions().modifyPushConfig(body=modify_push_config_request, subscription=\"projects/example-project/subscriptions/example-subscription\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.subscriptions.modifyPushConfig\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var modifyPushConfigRequest = new ModifyPushConfigRequest();\r\n // Add your code to populate the modifyPushConfigRequest object\r\n var call = pubsubService.Projects.Subscriptions.ModifyPushConfig(modifyPushConfigRequest, \"projects/example-project/subscriptions/example-subscription\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.subscriptions.pull.snippet.json b/pubsub.projects.subscriptions.pull.snippet.json new file mode 100644 index 0000000..a387f2b --- /dev/null +++ b/pubsub.projects.subscriptions.pull.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.subscriptions.pull\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tPullRequest pullRequest = new PullRequest();\r\n\t\t// Add your code to populate the pullRequest object\r\n\t\tPubsub.Projects.Subscriptions.Pull call = pubsubService.projects().subscriptions().pull(\"projects/example-project/subscriptions/example-subscription\", pullRequest);\r\n\t\tPullResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.subscriptions.pull\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\npull_request = {} # construct your object here\r\nrequest = service.projects().subscriptions().pull(body=pull_request, subscription=\"projects/example-project/subscriptions/example-subscription\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.subscriptions.pull\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var pullRequest = new PullRequest();\r\n // Add your code to populate the pullRequest object\r\n var call = pubsubService.Projects.Subscriptions.Pull(pullRequest, \"projects/example-project/subscriptions/example-subscription\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.subscriptions.setIamPolicy.snippet.json b/pubsub.projects.subscriptions.setIamPolicy.snippet.json new file mode 100644 index 0000000..da5da58 --- /dev/null +++ b/pubsub.projects.subscriptions.setIamPolicy.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.subscriptions.setIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tSetIamPolicyRequest setIamPolicyRequest = new SetIamPolicyRequest();\r\n\t\t// Add your code to populate the setIamPolicyRequest object\r\n\t\tPubsub.Projects.Subscriptions.SetIamPolicy call = pubsubService.projects().subscriptions().setIamPolicy(\"projects/example-project/subscriptions/example-subscription\", setIamPolicyRequest);\r\n\t\tPolicy response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.subscriptions.setIamPolicy\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\nset_iam_policy_request = {} # construct your object here\r\nrequest = service.projects().subscriptions().setIamPolicy(body=set_iam_policy_request, resource=\"projects/example-project/subscriptions/example-subscription\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.subscriptions.setIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var setIamPolicyRequest = new SetIamPolicyRequest();\r\n // Add your code to populate the setIamPolicyRequest object\r\n var call = pubsubService.Projects.Subscriptions.SetIamPolicy(setIamPolicyRequest, \"projects/example-project/subscriptions/example-subscription\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.subscriptions.testIamPermissions.snippet.json b/pubsub.projects.subscriptions.testIamPermissions.snippet.json new file mode 100644 index 0000000..8006ed8 --- /dev/null +++ b/pubsub.projects.subscriptions.testIamPermissions.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.subscriptions.testIamPermissions\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tTestIamPermissionsRequest testIamPermissionsRequest = new TestIamPermissionsRequest();\r\n\t\t// Add your code to populate the testIamPermissionsRequest object\r\n\t\tPubsub.Projects.Subscriptions.TestIamPermissions call = pubsubService.projects().subscriptions().testIamPermissions(\"projects/example-project/subscriptions/example-subscription\", testIamPermissionsRequest);\r\n\t\tTestIamPermissionsResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.subscriptions.testIamPermissions\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\ntest_iam_permissions_request = {} # construct your object here\r\nrequest = service.projects().subscriptions().testIamPermissions(body=test_iam_permissions_request, resource=\"projects/example-project/subscriptions/example-subscription\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.subscriptions.testIamPermissions\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var testIamPermissionsRequest = new TestIamPermissionsRequest();\r\n // Add your code to populate the testIamPermissionsRequest object\r\n var call = pubsubService.Projects.Subscriptions.TestIamPermissions(testIamPermissionsRequest, \"projects/example-project/subscriptions/example-subscription\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.topics.create.snippet.json b/pubsub.projects.topics.create.snippet.json new file mode 100644 index 0000000..509081f --- /dev/null +++ b/pubsub.projects.topics.create.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.topics.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tTopic topic = new Topic();\r\n\t\t// Add your code to populate the topic object\r\n\t\tPubsub.Projects.Topics.Create call = pubsubService.projects().topics().create(\"projects/example-project/topics/example-topic\", topic);\r\n\t\tTopic response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.topics.create\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\ntopic = {} # construct your object here\r\nrequest = service.projects().topics().create(body=topic, name=\"projects/example-project/topics/example-topic\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.topics.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var topic = new Topic();\r\n // Add your code to populate the topic object\r\n var call = pubsubService.Projects.Topics.Create(topic, \"projects/example-project/topics/example-topic\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.topics.delete.snippet.json b/pubsub.projects.topics.delete.snippet.json new file mode 100644 index 0000000..c219d8f --- /dev/null +++ b/pubsub.projects.topics.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.topics.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tPubsub.Projects.Topics.Delete request = pubsubService.projects().topics().delete(\"projects/example-project/topics/example-topic\");\r\n\t\tEmpty response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.topics.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\nservice.projects().topics().delete(topic=\"projects/example-project/topics/example-topic\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.topics.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = pubsubService.Projects.Topics.Delete(\"projects/example-project/topics/example-topic\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.topics.get.snippet.json b/pubsub.projects.topics.get.snippet.json new file mode 100644 index 0000000..08d9fdd --- /dev/null +++ b/pubsub.projects.topics.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.topics.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tPubsub.Projects.Topics.Get request = pubsubService.projects().topics().get(\"projects/example-project/topics/example-topic\");\r\n\t\tTopic response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.topics.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\nservice.projects().topics().get(topic=\"projects/example-project/topics/example-topic\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.topics.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = pubsubService.Projects.Topics.Get(\"projects/example-project/topics/example-topic\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.topics.getIamPolicy.snippet.json b/pubsub.projects.topics.getIamPolicy.snippet.json new file mode 100644 index 0000000..069c73a --- /dev/null +++ b/pubsub.projects.topics.getIamPolicy.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.topics.getIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tPubsub.Projects.Topics.GetIamPolicy request = pubsubService.projects().topics().getIamPolicy(\"projects/example-project/topics/example-topic\");\r\n\t\tPolicy response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.topics.getIamPolicy\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\nservice.projects().topics().getIamPolicy(resource=\"projects/example-project/topics/example-topic\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.topics.getIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = pubsubService.Projects.Topics.GetIamPolicy(\"projects/example-project/topics/example-topic\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.topics.list.snippet.json b/pubsub.projects.topics.list.snippet.json new file mode 100644 index 0000000..7e7f974 --- /dev/null +++ b/pubsub.projects.topics.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.topics.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tListTopicsResponse response;\r\n\t\tPubsub.Projects.Topics.List request = pubsubService.projects().topics().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getTopics() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Topic item : response.getTopics()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.topics.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\nrequest = service.projects().topics().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.projects().topics().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.topics.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListTopicsResponse response;\r\n var request = pubsubService.Projects.Topics.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Topics == null)\r\n continue;\r\n\r\n foreach (var item in response.Topics)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.topics.publish.snippet.json b/pubsub.projects.topics.publish.snippet.json new file mode 100644 index 0000000..6b43f9a --- /dev/null +++ b/pubsub.projects.topics.publish.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.topics.publish\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tPublishRequest publishRequest = new PublishRequest();\r\n\t\t// Add your code to populate the publishRequest object\r\n\t\tPubsub.Projects.Topics.Publish call = pubsubService.projects().topics().publish(\"projects/example-project/topics/example-topic\", publishRequest);\r\n\t\tPublishResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.topics.publish\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\npublish_request = {} # construct your object here\r\nrequest = service.projects().topics().publish(body=publish_request, topic=\"projects/example-project/topics/example-topic\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.topics.publish\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var publishRequest = new PublishRequest();\r\n // Add your code to populate the publishRequest object\r\n var call = pubsubService.Projects.Topics.Publish(publishRequest, \"projects/example-project/topics/example-topic\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.topics.setIamPolicy.snippet.json b/pubsub.projects.topics.setIamPolicy.snippet.json new file mode 100644 index 0000000..e384596 --- /dev/null +++ b/pubsub.projects.topics.setIamPolicy.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.topics.setIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tSetIamPolicyRequest setIamPolicyRequest = new SetIamPolicyRequest();\r\n\t\t// Add your code to populate the setIamPolicyRequest object\r\n\t\tPubsub.Projects.Topics.SetIamPolicy call = pubsubService.projects().topics().setIamPolicy(\"projects/example-project/topics/example-topic\", setIamPolicyRequest);\r\n\t\tPolicy response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.topics.setIamPolicy\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\nset_iam_policy_request = {} # construct your object here\r\nrequest = service.projects().topics().setIamPolicy(body=set_iam_policy_request, resource=\"projects/example-project/topics/example-topic\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.topics.setIamPolicy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var setIamPolicyRequest = new SetIamPolicyRequest();\r\n // Add your code to populate the setIamPolicyRequest object\r\n var call = pubsubService.Projects.Topics.SetIamPolicy(setIamPolicyRequest, \"projects/example-project/topics/example-topic\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.topics.subscriptions.list.snippet.json b/pubsub.projects.topics.subscriptions.list.snippet.json new file mode 100644 index 0000000..9f34503 --- /dev/null +++ b/pubsub.projects.topics.subscriptions.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.topics.subscriptions.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tListTopicSubscriptionsResponse response;\r\n\t\tPubsub.Projects.Topics.Subscriptions.List request = pubsubService.projects().topics().subscriptions().list(\"projects/example-project/topics/example-topic\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getSubscriptions() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (String item : response.getSubscriptions()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.topics.subscriptions.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\nrequest = service.projects().topics().subscriptions().list(topic=\"projects/example-project/topics/example-topic\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.projects().topics().subscriptions().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.topics.subscriptions.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListTopicSubscriptionsResponse response;\r\n var request = pubsubService.Projects.Topics.Subscriptions.List(\"projects/example-project/topics/example-topic\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Subscriptions == null)\r\n continue;\r\n\r\n foreach (var item in response.Subscriptions)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/pubsub.projects.topics.testIamPermissions.snippet.json b/pubsub.projects.topics.testIamPermissions.snippet.json new file mode 100644 index 0000000..c4880f6 --- /dev/null +++ b/pubsub.projects.topics.testIamPermissions.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"pubsub","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for pubsub.projects.topics.testIamPermissions\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/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/pubsub/v1/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.pubsub.Pubsub;\r\nimport com.google.api.services.pubsub.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class PubsubSample {\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\tPubsub pubsubService = new Pubsub.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\tTestIamPermissionsRequest testIamPermissionsRequest = new TestIamPermissionsRequest();\r\n\t\t// Add your code to populate the testIamPermissionsRequest object\r\n\t\tPubsub.Projects.Topics.TestIamPermissions call = pubsubService.projects().topics().testIamPermissions(\"projects/example-project/topics/example-topic\", testIamPermissionsRequest);\r\n\t\tTestIamPermissionsResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for pubsub.projects.topics.testIamPermissions\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable pubsub Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/pubsub/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 'pubsub' service, at version 'v1'.\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('pubsub', 'v1', credentials=credentials)\r\n\r\ntest_iam_permissions_request = {} # construct your object here\r\nrequest = service.projects().topics().testIamPermissions(body=test_iam_permissions_request, resource=\"projects/example-project/topics/example-topic\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for pubsub.projects.topics.testIamPermissions\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable pubsub Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/pubsub/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.pubsub.v1\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.Pubsub.v1;\r\nusing Google.Apis.Pubsub.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass PubsubSample\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 pubsubService = new PubsubService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var testIamPermissionsRequest = new TestIamPermissionsRequest();\r\n // Add your code to populate the testIamPermissionsRequest object\r\n var call = pubsubService.Projects.Topics.TestIamPermissions(testIamPermissionsRequest, \"projects/example-project/topics/example-topic\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapool.instanceGroupManagers.abandonInstances.snippet.json b/replicapool.instanceGroupManagers.abandonInstances.snippet.json new file mode 100644 index 0000000..adafd4c --- /dev/null +++ b/replicapool.instanceGroupManagers.abandonInstances.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapool","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapool.instanceGroupManagers.abandonInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/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/replicapool/v1beta2/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.replicapool.Replicapool;\r\nimport com.google.api.services.replicapool.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolSample {\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\tReplicapool replicapoolService = new Replicapool.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\tInstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequest = new InstanceGroupManagersAbandonInstancesRequest();\r\n\t\t// Add your code to populate the instanceGroupManagersAbandonInstancesRequest object\r\n\t\tReplicapool.InstanceGroupManagers.AbandonInstances call = replicapoolService.instanceGroupManagers().abandonInstances(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\", instanceGroupManagersAbandonInstancesRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for replicapool.instanceGroupManagers.abandonInstances\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapool Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapool/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 'replicapool' service, at version 'v1beta2'.\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('replicapool', 'v1beta2', credentials=credentials)\r\n\r\ninstance_group_managers_abandon_instances_request = {} # construct your object here\r\nrequest = service.instanceGroupManagers().abandonInstances(body=instance_group_managers_abandon_instances_request, project=\"example-project\", zone=\"us-central1-a\", instanceGroupManager=\"example-instanceGroupManager\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapool.instanceGroupManagers.abandonInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapool.v1beta2\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.Replicapool.v1beta2;\r\nusing Google.Apis.Replicapool.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolSample\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 replicapoolService = new ReplicapoolService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceGroupManagersAbandonInstancesRequest = new InstanceGroupManagersAbandonInstancesRequest();\r\n // Add your code to populate the instanceGroupManagersAbandonInstancesRequest object\r\n var call = replicapoolService.InstanceGroupManagers.AbandonInstances(instanceGroupManagersAbandonInstancesRequest, \"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapool.instanceGroupManagers.delete.snippet.json b/replicapool.instanceGroupManagers.delete.snippet.json new file mode 100644 index 0000000..2931f2b --- /dev/null +++ b/replicapool.instanceGroupManagers.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapool","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapool.instanceGroupManagers.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/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/replicapool/v1beta2/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.replicapool.Replicapool;\r\nimport com.google.api.services.replicapool.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolSample {\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\tReplicapool replicapoolService = new Replicapool.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\tReplicapool.InstanceGroupManagers.Delete request = replicapoolService.instanceGroupManagers().delete(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for replicapool.instanceGroupManagers.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapool Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapool/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 'replicapool' service, at version 'v1beta2'.\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('replicapool', 'v1beta2', credentials=credentials)\r\n\r\nservice.instanceGroupManagers().delete(project=\"example-project\", zone=\"us-central1-a\", instanceGroupManager=\"example-instanceGroupManager\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapool.instanceGroupManagers.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapool.v1beta2\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.Replicapool.v1beta2;\r\nusing Google.Apis.Replicapool.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolSample\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 replicapoolService = new ReplicapoolService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = replicapoolService.InstanceGroupManagers.Delete(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapool.instanceGroupManagers.deleteInstances.snippet.json b/replicapool.instanceGroupManagers.deleteInstances.snippet.json new file mode 100644 index 0000000..80c92f9 --- /dev/null +++ b/replicapool.instanceGroupManagers.deleteInstances.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapool","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapool.instanceGroupManagers.deleteInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/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/replicapool/v1beta2/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.replicapool.Replicapool;\r\nimport com.google.api.services.replicapool.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolSample {\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\tReplicapool replicapoolService = new Replicapool.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\tInstanceGroupManagersDeleteInstancesRequest instanceGroupManagersDeleteInstancesRequest = new InstanceGroupManagersDeleteInstancesRequest();\r\n\t\t// Add your code to populate the instanceGroupManagersDeleteInstancesRequest object\r\n\t\tReplicapool.InstanceGroupManagers.DeleteInstances call = replicapoolService.instanceGroupManagers().deleteInstances(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\", instanceGroupManagersDeleteInstancesRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for replicapool.instanceGroupManagers.deleteInstances\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapool Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapool/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 'replicapool' service, at version 'v1beta2'.\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('replicapool', 'v1beta2', credentials=credentials)\r\n\r\ninstance_group_managers_delete_instances_request = {} # construct your object here\r\nrequest = service.instanceGroupManagers().deleteInstances(body=instance_group_managers_delete_instances_request, project=\"example-project\", zone=\"us-central1-a\", instanceGroupManager=\"example-instanceGroupManager\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapool.instanceGroupManagers.deleteInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapool.v1beta2\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.Replicapool.v1beta2;\r\nusing Google.Apis.Replicapool.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolSample\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 replicapoolService = new ReplicapoolService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceGroupManagersDeleteInstancesRequest = new InstanceGroupManagersDeleteInstancesRequest();\r\n // Add your code to populate the instanceGroupManagersDeleteInstancesRequest object\r\n var call = replicapoolService.InstanceGroupManagers.DeleteInstances(instanceGroupManagersDeleteInstancesRequest, \"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapool.instanceGroupManagers.get.snippet.json b/replicapool.instanceGroupManagers.get.snippet.json new file mode 100644 index 0000000..0c232df --- /dev/null +++ b/replicapool.instanceGroupManagers.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapool","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapool.instanceGroupManagers.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/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/replicapool/v1beta2/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.replicapool.Replicapool;\r\nimport com.google.api.services.replicapool.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolSample {\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\tReplicapool replicapoolService = new Replicapool.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\tReplicapool.InstanceGroupManagers.Get request = replicapoolService.instanceGroupManagers().get(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n\t\tInstanceGroupManager response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for replicapool.instanceGroupManagers.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapool Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapool/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 'replicapool' service, at version 'v1beta2'.\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('replicapool', 'v1beta2', credentials=credentials)\r\n\r\nservice.instanceGroupManagers().get(project=\"example-project\", zone=\"us-central1-a\", instanceGroupManager=\"example-instanceGroupManager\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapool.instanceGroupManagers.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapool.v1beta2\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.Replicapool.v1beta2;\r\nusing Google.Apis.Replicapool.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolSample\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 replicapoolService = new ReplicapoolService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = replicapoolService.InstanceGroupManagers.Get(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapool.instanceGroupManagers.insert.snippet.json b/replicapool.instanceGroupManagers.insert.snippet.json new file mode 100644 index 0000000..b55d4cc --- /dev/null +++ b/replicapool.instanceGroupManagers.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapool","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapool.instanceGroupManagers.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/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/replicapool/v1beta2/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.replicapool.Replicapool;\r\nimport com.google.api.services.replicapool.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolSample {\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\tReplicapool replicapoolService = new Replicapool.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\tInstanceGroupManager instanceGroupManager = new InstanceGroupManager();\r\n\t\t// Add your code to populate the instanceGroupManager object\r\n\t\tReplicapool.InstanceGroupManagers.Insert call = replicapoolService.instanceGroupManagers().insert(\"example-project\", \"us-central1-a\", size_of_type_integer, instanceGroupManager);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for replicapool.instanceGroupManagers.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapool Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapool/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 'replicapool' service, at version 'v1beta2'.\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('replicapool', 'v1beta2', credentials=credentials)\r\n\r\ninstance_group_manager = {} # construct your object here\r\nrequest = service.instanceGroupManagers().insert(body=instance_group_manager, project=\"example-project\", zone=\"us-central1-a\", size=size_of_type_integer)\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapool.instanceGroupManagers.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapool.v1beta2\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.Replicapool.v1beta2;\r\nusing Google.Apis.Replicapool.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolSample\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 replicapoolService = new ReplicapoolService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceGroupManager = new InstanceGroupManager();\r\n // Add your code to populate the instanceGroupManager object\r\n var call = replicapoolService.InstanceGroupManagers.Insert(instanceGroupManager, \"example-project\", \"us-central1-a\", size_of_type_integer);\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapool.instanceGroupManagers.list.snippet.json b/replicapool.instanceGroupManagers.list.snippet.json new file mode 100644 index 0000000..6d91d0c --- /dev/null +++ b/replicapool.instanceGroupManagers.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapool","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapool.instanceGroupManagers.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/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/replicapool/v1beta2/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.replicapool.Replicapool;\r\nimport com.google.api.services.replicapool.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolSample {\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\tReplicapool replicapoolService = new Replicapool.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\tInstanceGroupManagerList response;\r\n\t\tReplicapool.InstanceGroupManagers.List request = replicapoolService.instanceGroupManagers().list(\"example-project\", \"us-central1-a\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (InstanceGroupManager item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for replicapool.instanceGroupManagers.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapool Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapool/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 'replicapool' service, at version 'v1beta2'.\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('replicapool', 'v1beta2', credentials=credentials)\r\n\r\nrequest = service.instanceGroupManagers().list(project=\"example-project\", zone=\"us-central1-a\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.instanceGroupManagers().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapool.instanceGroupManagers.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapool.v1beta2\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.Replicapool.v1beta2;\r\nusing Google.Apis.Replicapool.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolSample\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 replicapoolService = new ReplicapoolService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n InstanceGroupManagerList response;\r\n var request = replicapoolService.InstanceGroupManagers.List(\"example-project\", \"us-central1-a\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapool.instanceGroupManagers.recreateInstances.snippet.json b/replicapool.instanceGroupManagers.recreateInstances.snippet.json new file mode 100644 index 0000000..232ff6c --- /dev/null +++ b/replicapool.instanceGroupManagers.recreateInstances.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapool","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapool.instanceGroupManagers.recreateInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/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/replicapool/v1beta2/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.replicapool.Replicapool;\r\nimport com.google.api.services.replicapool.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolSample {\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\tReplicapool replicapoolService = new Replicapool.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\tInstanceGroupManagersRecreateInstancesRequest instanceGroupManagersRecreateInstancesRequest = new InstanceGroupManagersRecreateInstancesRequest();\r\n\t\t// Add your code to populate the instanceGroupManagersRecreateInstancesRequest object\r\n\t\tReplicapool.InstanceGroupManagers.RecreateInstances call = replicapoolService.instanceGroupManagers().recreateInstances(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\", instanceGroupManagersRecreateInstancesRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for replicapool.instanceGroupManagers.recreateInstances\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapool Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapool/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 'replicapool' service, at version 'v1beta2'.\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('replicapool', 'v1beta2', credentials=credentials)\r\n\r\ninstance_group_managers_recreate_instances_request = {} # construct your object here\r\nrequest = service.instanceGroupManagers().recreateInstances(body=instance_group_managers_recreate_instances_request, project=\"example-project\", zone=\"us-central1-a\", instanceGroupManager=\"example-instanceGroupManager\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapool.instanceGroupManagers.recreateInstances\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapool.v1beta2\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.Replicapool.v1beta2;\r\nusing Google.Apis.Replicapool.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolSample\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 replicapoolService = new ReplicapoolService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceGroupManagersRecreateInstancesRequest = new InstanceGroupManagersRecreateInstancesRequest();\r\n // Add your code to populate the instanceGroupManagersRecreateInstancesRequest object\r\n var call = replicapoolService.InstanceGroupManagers.RecreateInstances(instanceGroupManagersRecreateInstancesRequest, \"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapool.instanceGroupManagers.resize.snippet.json b/replicapool.instanceGroupManagers.resize.snippet.json new file mode 100644 index 0000000..86cebdb --- /dev/null +++ b/replicapool.instanceGroupManagers.resize.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapool","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapool.instanceGroupManagers.resize\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/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/replicapool/v1beta2/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.replicapool.Replicapool;\r\nimport com.google.api.services.replicapool.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolSample {\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\tReplicapool replicapoolService = new Replicapool.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\tReplicapool.InstanceGroupManagers.Resize request = replicapoolService.instanceGroupManagers().resize(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\", size_of_type_integer);\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for replicapool.instanceGroupManagers.resize\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapool Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapool/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 'replicapool' service, at version 'v1beta2'.\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('replicapool', 'v1beta2', credentials=credentials)\r\n\r\nservice.instanceGroupManagers().resize(project=\"example-project\", zone=\"us-central1-a\", instanceGroupManager=\"example-instanceGroupManager\", size=size_of_type_integer).execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapool.instanceGroupManagers.resize\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapool.v1beta2\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.Replicapool.v1beta2;\r\nusing Google.Apis.Replicapool.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolSample\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 replicapoolService = new ReplicapoolService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = replicapoolService.InstanceGroupManagers.Resize(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\", size_of_type_integer);\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapool.instanceGroupManagers.setInstanceTemplate.snippet.json b/replicapool.instanceGroupManagers.setInstanceTemplate.snippet.json new file mode 100644 index 0000000..0bdf038 --- /dev/null +++ b/replicapool.instanceGroupManagers.setInstanceTemplate.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapool","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapool.instanceGroupManagers.setInstanceTemplate\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/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/replicapool/v1beta2/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.replicapool.Replicapool;\r\nimport com.google.api.services.replicapool.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolSample {\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\tReplicapool replicapoolService = new Replicapool.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\tInstanceGroupManagersSetInstanceTemplateRequest instanceGroupManagersSetInstanceTemplateRequest = new InstanceGroupManagersSetInstanceTemplateRequest();\r\n\t\t// Add your code to populate the instanceGroupManagersSetInstanceTemplateRequest object\r\n\t\tReplicapool.InstanceGroupManagers.SetInstanceTemplate call = replicapoolService.instanceGroupManagers().setInstanceTemplate(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\", instanceGroupManagersSetInstanceTemplateRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for replicapool.instanceGroupManagers.setInstanceTemplate\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapool Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapool/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 'replicapool' service, at version 'v1beta2'.\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('replicapool', 'v1beta2', credentials=credentials)\r\n\r\ninstance_group_managers_set_instance_template_request = {} # construct your object here\r\nrequest = service.instanceGroupManagers().setInstanceTemplate(body=instance_group_managers_set_instance_template_request, project=\"example-project\", zone=\"us-central1-a\", instanceGroupManager=\"example-instanceGroupManager\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapool.instanceGroupManagers.setInstanceTemplate\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapool.v1beta2\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.Replicapool.v1beta2;\r\nusing Google.Apis.Replicapool.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolSample\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 replicapoolService = new ReplicapoolService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceGroupManagersSetInstanceTemplateRequest = new InstanceGroupManagersSetInstanceTemplateRequest();\r\n // Add your code to populate the instanceGroupManagersSetInstanceTemplateRequest object\r\n var call = replicapoolService.InstanceGroupManagers.SetInstanceTemplate(instanceGroupManagersSetInstanceTemplateRequest, \"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapool.instanceGroupManagers.setTargetPools.snippet.json b/replicapool.instanceGroupManagers.setTargetPools.snippet.json new file mode 100644 index 0000000..24670d6 --- /dev/null +++ b/replicapool.instanceGroupManagers.setTargetPools.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapool","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapool.instanceGroupManagers.setTargetPools\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/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/replicapool/v1beta2/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.replicapool.Replicapool;\r\nimport com.google.api.services.replicapool.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolSample {\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\tReplicapool replicapoolService = new Replicapool.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\tInstanceGroupManagersSetTargetPoolsRequest instanceGroupManagersSetTargetPoolsRequest = new InstanceGroupManagersSetTargetPoolsRequest();\r\n\t\t// Add your code to populate the instanceGroupManagersSetTargetPoolsRequest object\r\n\t\tReplicapool.InstanceGroupManagers.SetTargetPools call = replicapoolService.instanceGroupManagers().setTargetPools(\"example-project\", \"us-central1-a\", \"example-instanceGroupManager\", instanceGroupManagersSetTargetPoolsRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for replicapool.instanceGroupManagers.setTargetPools\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapool Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapool/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 'replicapool' service, at version 'v1beta2'.\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('replicapool', 'v1beta2', credentials=credentials)\r\n\r\ninstance_group_managers_set_target_pools_request = {} # construct your object here\r\nrequest = service.instanceGroupManagers().setTargetPools(body=instance_group_managers_set_target_pools_request, project=\"example-project\", zone=\"us-central1-a\", instanceGroupManager=\"example-instanceGroupManager\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapool.instanceGroupManagers.setTargetPools\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapool.v1beta2\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.Replicapool.v1beta2;\r\nusing Google.Apis.Replicapool.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolSample\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 replicapoolService = new ReplicapoolService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instanceGroupManagersSetTargetPoolsRequest = new InstanceGroupManagersSetTargetPoolsRequest();\r\n // Add your code to populate the instanceGroupManagersSetTargetPoolsRequest object\r\n var call = replicapoolService.InstanceGroupManagers.SetTargetPools(instanceGroupManagersSetTargetPoolsRequest, \"example-project\", \"us-central1-a\", \"example-instanceGroupManager\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapool.zoneOperations.get.snippet.json b/replicapool.zoneOperations.get.snippet.json new file mode 100644 index 0000000..57ac437 --- /dev/null +++ b/replicapool.zoneOperations.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapool","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapool.zoneOperations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/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/replicapool/v1beta2/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.replicapool.Replicapool;\r\nimport com.google.api.services.replicapool.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolSample {\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\tReplicapool replicapoolService = new Replicapool.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\tReplicapool.ZoneOperations.Get request = replicapoolService.zoneOperations().get(\"example-project\", \"us-central1-a\", \"example-operation\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for replicapool.zoneOperations.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapool Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapool/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 'replicapool' service, at version 'v1beta2'.\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('replicapool', 'v1beta2', credentials=credentials)\r\n\r\nservice.zoneOperations().get(project=\"example-project\", zone=\"us-central1-a\", operation=\"example-operation\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapool.zoneOperations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapool.v1beta2\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.Replicapool.v1beta2;\r\nusing Google.Apis.Replicapool.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolSample\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 replicapoolService = new ReplicapoolService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = replicapoolService.ZoneOperations.Get(\"example-project\", \"us-central1-a\", \"example-operation\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapool.zoneOperations.list.snippet.json b/replicapool.zoneOperations.list.snippet.json new file mode 100644 index 0000000..f4a6141 --- /dev/null +++ b/replicapool.zoneOperations.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapool","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapool.zoneOperations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/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/replicapool/v1beta2/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.replicapool.Replicapool;\r\nimport com.google.api.services.replicapool.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolSample {\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\tReplicapool replicapoolService = new Replicapool.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\tOperationList response;\r\n\t\tReplicapool.ZoneOperations.List request = replicapoolService.zoneOperations().list(\"example-project\", \"us-central1-a\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Operation item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for replicapool.zoneOperations.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapool Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapool/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 'replicapool' service, at version 'v1beta2'.\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('replicapool', 'v1beta2', credentials=credentials)\r\n\r\nrequest = service.zoneOperations().list(project=\"example-project\", zone=\"us-central1-a\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.zoneOperations().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapool.zoneOperations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapool Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapool/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapool.v1beta2\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.Replicapool.v1beta2;\r\nusing Google.Apis.Replicapool.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolSample\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 replicapoolService = new ReplicapoolService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n OperationList response;\r\n var request = replicapoolService.ZoneOperations.List(\"example-project\", \"us-central1-a\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapoolupdater.rollingUpdates.cancel.snippet.json b/replicapoolupdater.rollingUpdates.cancel.snippet.json new file mode 100644 index 0000000..45f45d4 --- /dev/null +++ b/replicapoolupdater.rollingUpdates.cancel.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapoolupdater","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapoolupdater.rollingUpdates.cancel\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/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/replicapoolupdater/v1beta1/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.replicapoolupdater.Replicapoolupdater;\r\nimport com.google.api.services.replicapoolupdater.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolupdaterSample {\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\tReplicapoolupdater replicapoolupdaterService = new Replicapoolupdater.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\tReplicapoolupdater.RollingUpdates.Cancel request = replicapoolupdaterService.rollingUpdates().cancel(\"example-project\", \"us-central1-a\", \"example-rollingUpdate\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for replicapoolupdater.rollingUpdates.cancel\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapoolupdater/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 'replicapoolupdater' service, at version 'v1beta1'.\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('replicapoolupdater', 'v1beta1', credentials=credentials)\r\n\r\nservice.rollingUpdates().cancel(project=\"example-project\", zone=\"us-central1-a\", rollingUpdate=\"example-rollingUpdate\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapoolupdater.rollingUpdates.cancel\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapoolupdater.v1beta1\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.Replicapoolupdater.v1beta1;\r\nusing Google.Apis.Replicapoolupdater.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolupdaterSample\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 replicapoolupdaterService = new ReplicapoolupdaterService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = replicapoolupdaterService.RollingUpdates.Cancel(\"example-project\", \"us-central1-a\", \"example-rollingUpdate\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapoolupdater.rollingUpdates.get.snippet.json b/replicapoolupdater.rollingUpdates.get.snippet.json new file mode 100644 index 0000000..f0c2821 --- /dev/null +++ b/replicapoolupdater.rollingUpdates.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapoolupdater","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapoolupdater.rollingUpdates.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/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/replicapoolupdater/v1beta1/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.replicapoolupdater.Replicapoolupdater;\r\nimport com.google.api.services.replicapoolupdater.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolupdaterSample {\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\tReplicapoolupdater replicapoolupdaterService = new Replicapoolupdater.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\tReplicapoolupdater.RollingUpdates.Get request = replicapoolupdaterService.rollingUpdates().get(\"example-project\", \"us-central1-a\", \"example-rollingUpdate\");\r\n\t\tRollingUpdate response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for replicapoolupdater.rollingUpdates.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapoolupdater/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 'replicapoolupdater' service, at version 'v1beta1'.\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('replicapoolupdater', 'v1beta1', credentials=credentials)\r\n\r\nservice.rollingUpdates().get(project=\"example-project\", zone=\"us-central1-a\", rollingUpdate=\"example-rollingUpdate\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapoolupdater.rollingUpdates.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapoolupdater.v1beta1\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.Replicapoolupdater.v1beta1;\r\nusing Google.Apis.Replicapoolupdater.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolupdaterSample\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 replicapoolupdaterService = new ReplicapoolupdaterService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = replicapoolupdaterService.RollingUpdates.Get(\"example-project\", \"us-central1-a\", \"example-rollingUpdate\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapoolupdater.rollingUpdates.insert.snippet.json b/replicapoolupdater.rollingUpdates.insert.snippet.json new file mode 100644 index 0000000..89812aa --- /dev/null +++ b/replicapoolupdater.rollingUpdates.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapoolupdater","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapoolupdater.rollingUpdates.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/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/replicapoolupdater/v1beta1/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.replicapoolupdater.Replicapoolupdater;\r\nimport com.google.api.services.replicapoolupdater.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolupdaterSample {\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\tReplicapoolupdater replicapoolupdaterService = new Replicapoolupdater.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\tRollingUpdate rollingUpdate = new RollingUpdate();\r\n\t\t// Add your code to populate the rollingUpdate object\r\n\t\tReplicapoolupdater.RollingUpdates.Insert call = replicapoolupdaterService.rollingUpdates().insert(\"example-project\", \"us-central1-a\", rollingUpdate);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for replicapoolupdater.rollingUpdates.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapoolupdater/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 'replicapoolupdater' service, at version 'v1beta1'.\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('replicapoolupdater', 'v1beta1', credentials=credentials)\r\n\r\nrolling_update = {} # construct your object here\r\nrequest = service.rollingUpdates().insert(body=rolling_update, project=\"example-project\", zone=\"us-central1-a\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapoolupdater.rollingUpdates.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapoolupdater.v1beta1\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.Replicapoolupdater.v1beta1;\r\nusing Google.Apis.Replicapoolupdater.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolupdaterSample\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 replicapoolupdaterService = new ReplicapoolupdaterService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var rollingUpdate = new RollingUpdate();\r\n // Add your code to populate the rollingUpdate object\r\n var call = replicapoolupdaterService.RollingUpdates.Insert(rollingUpdate, \"example-project\", \"us-central1-a\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapoolupdater.rollingUpdates.list.snippet.json b/replicapoolupdater.rollingUpdates.list.snippet.json new file mode 100644 index 0000000..0b16806 --- /dev/null +++ b/replicapoolupdater.rollingUpdates.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapoolupdater","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapoolupdater.rollingUpdates.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/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/replicapoolupdater/v1beta1/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.replicapoolupdater.Replicapoolupdater;\r\nimport com.google.api.services.replicapoolupdater.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolupdaterSample {\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\tReplicapoolupdater replicapoolupdaterService = new Replicapoolupdater.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\tRollingUpdateList response;\r\n\t\tReplicapoolupdater.RollingUpdates.List request = replicapoolupdaterService.rollingUpdates().list(\"example-project\", \"us-central1-a\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (RollingUpdate item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for replicapoolupdater.rollingUpdates.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapoolupdater/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 'replicapoolupdater' service, at version 'v1beta1'.\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('replicapoolupdater', 'v1beta1', credentials=credentials)\r\n\r\nrequest = service.rollingUpdates().list(project=\"example-project\", zone=\"us-central1-a\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.rollingUpdates().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapoolupdater.rollingUpdates.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapoolupdater.v1beta1\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.Replicapoolupdater.v1beta1;\r\nusing Google.Apis.Replicapoolupdater.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolupdaterSample\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 replicapoolupdaterService = new ReplicapoolupdaterService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n RollingUpdateList response;\r\n var request = replicapoolupdaterService.RollingUpdates.List(\"example-project\", \"us-central1-a\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapoolupdater.rollingUpdates.listInstanceUpdates.snippet.json b/replicapoolupdater.rollingUpdates.listInstanceUpdates.snippet.json new file mode 100644 index 0000000..fa18745 --- /dev/null +++ b/replicapoolupdater.rollingUpdates.listInstanceUpdates.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapoolupdater","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapoolupdater.rollingUpdates.listInstanceUpdates\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/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/replicapoolupdater/v1beta1/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.replicapoolupdater.Replicapoolupdater;\r\nimport com.google.api.services.replicapoolupdater.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolupdaterSample {\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\tReplicapoolupdater replicapoolupdaterService = new Replicapoolupdater.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\tInstanceUpdateList response;\r\n\t\tReplicapoolupdater.RollingUpdates.ListInstanceUpdates request = replicapoolupdaterService.rollingUpdates().listInstanceUpdates(\"example-project\", \"us-central1-a\", \"example-rollingUpdate\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (InstanceUpdate item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for replicapoolupdater.rollingUpdates.listInstanceUpdates\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapoolupdater/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 'replicapoolupdater' service, at version 'v1beta1'.\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('replicapoolupdater', 'v1beta1', credentials=credentials)\r\n\r\nrequest = service.rollingUpdates().listInstanceUpdates(project=\"example-project\", zone=\"us-central1-a\", rollingUpdate=\"example-rollingUpdate\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.rollingUpdates().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapoolupdater.rollingUpdates.listInstanceUpdates\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapoolupdater.v1beta1\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.Replicapoolupdater.v1beta1;\r\nusing Google.Apis.Replicapoolupdater.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolupdaterSample\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 replicapoolupdaterService = new ReplicapoolupdaterService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n InstanceUpdateList response;\r\n var request = replicapoolupdaterService.RollingUpdates.ListInstanceUpdates(\"example-project\", \"us-central1-a\", \"example-rollingUpdate\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapoolupdater.rollingUpdates.pause.snippet.json b/replicapoolupdater.rollingUpdates.pause.snippet.json new file mode 100644 index 0000000..d86b22b --- /dev/null +++ b/replicapoolupdater.rollingUpdates.pause.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapoolupdater","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapoolupdater.rollingUpdates.pause\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/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/replicapoolupdater/v1beta1/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.replicapoolupdater.Replicapoolupdater;\r\nimport com.google.api.services.replicapoolupdater.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolupdaterSample {\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\tReplicapoolupdater replicapoolupdaterService = new Replicapoolupdater.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\tReplicapoolupdater.RollingUpdates.Pause request = replicapoolupdaterService.rollingUpdates().pause(\"example-project\", \"us-central1-a\", \"example-rollingUpdate\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for replicapoolupdater.rollingUpdates.pause\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapoolupdater/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 'replicapoolupdater' service, at version 'v1beta1'.\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('replicapoolupdater', 'v1beta1', credentials=credentials)\r\n\r\nservice.rollingUpdates().pause(project=\"example-project\", zone=\"us-central1-a\", rollingUpdate=\"example-rollingUpdate\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapoolupdater.rollingUpdates.pause\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapoolupdater.v1beta1\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.Replicapoolupdater.v1beta1;\r\nusing Google.Apis.Replicapoolupdater.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolupdaterSample\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 replicapoolupdaterService = new ReplicapoolupdaterService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = replicapoolupdaterService.RollingUpdates.Pause(\"example-project\", \"us-central1-a\", \"example-rollingUpdate\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapoolupdater.rollingUpdates.resume.snippet.json b/replicapoolupdater.rollingUpdates.resume.snippet.json new file mode 100644 index 0000000..dc33834 --- /dev/null +++ b/replicapoolupdater.rollingUpdates.resume.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapoolupdater","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapoolupdater.rollingUpdates.resume\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/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/replicapoolupdater/v1beta1/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.replicapoolupdater.Replicapoolupdater;\r\nimport com.google.api.services.replicapoolupdater.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolupdaterSample {\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\tReplicapoolupdater replicapoolupdaterService = new Replicapoolupdater.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\tReplicapoolupdater.RollingUpdates.Resume request = replicapoolupdaterService.rollingUpdates().resume(\"example-project\", \"us-central1-a\", \"example-rollingUpdate\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for replicapoolupdater.rollingUpdates.resume\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapoolupdater/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 'replicapoolupdater' service, at version 'v1beta1'.\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('replicapoolupdater', 'v1beta1', credentials=credentials)\r\n\r\nservice.rollingUpdates().resume(project=\"example-project\", zone=\"us-central1-a\", rollingUpdate=\"example-rollingUpdate\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapoolupdater.rollingUpdates.resume\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapoolupdater.v1beta1\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.Replicapoolupdater.v1beta1;\r\nusing Google.Apis.Replicapoolupdater.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolupdaterSample\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 replicapoolupdaterService = new ReplicapoolupdaterService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = replicapoolupdaterService.RollingUpdates.Resume(\"example-project\", \"us-central1-a\", \"example-rollingUpdate\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapoolupdater.rollingUpdates.rollback.snippet.json b/replicapoolupdater.rollingUpdates.rollback.snippet.json new file mode 100644 index 0000000..0920469 --- /dev/null +++ b/replicapoolupdater.rollingUpdates.rollback.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapoolupdater","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapoolupdater.rollingUpdates.rollback\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/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/replicapoolupdater/v1beta1/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.replicapoolupdater.Replicapoolupdater;\r\nimport com.google.api.services.replicapoolupdater.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolupdaterSample {\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\tReplicapoolupdater replicapoolupdaterService = new Replicapoolupdater.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\tReplicapoolupdater.RollingUpdates.Rollback request = replicapoolupdaterService.rollingUpdates().rollback(\"example-project\", \"us-central1-a\", \"example-rollingUpdate\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for replicapoolupdater.rollingUpdates.rollback\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapoolupdater/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 'replicapoolupdater' service, at version 'v1beta1'.\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('replicapoolupdater', 'v1beta1', credentials=credentials)\r\n\r\nservice.rollingUpdates().rollback(project=\"example-project\", zone=\"us-central1-a\", rollingUpdate=\"example-rollingUpdate\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapoolupdater.rollingUpdates.rollback\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapoolupdater.v1beta1\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.Replicapoolupdater.v1beta1;\r\nusing Google.Apis.Replicapoolupdater.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolupdaterSample\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 replicapoolupdaterService = new ReplicapoolupdaterService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = replicapoolupdaterService.RollingUpdates.Rollback(\"example-project\", \"us-central1-a\", \"example-rollingUpdate\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapoolupdater.zoneOperations.get.snippet.json b/replicapoolupdater.zoneOperations.get.snippet.json new file mode 100644 index 0000000..3322df2 --- /dev/null +++ b/replicapoolupdater.zoneOperations.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapoolupdater","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapoolupdater.zoneOperations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/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/replicapoolupdater/v1beta1/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.replicapoolupdater.Replicapoolupdater;\r\nimport com.google.api.services.replicapoolupdater.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolupdaterSample {\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\tReplicapoolupdater replicapoolupdaterService = new Replicapoolupdater.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\tReplicapoolupdater.ZoneOperations.Get request = replicapoolupdaterService.zoneOperations().get(\"example-project\", \"us-central1-a\", \"example-operation\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for replicapoolupdater.zoneOperations.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapoolupdater/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 'replicapoolupdater' service, at version 'v1beta1'.\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('replicapoolupdater', 'v1beta1', credentials=credentials)\r\n\r\nservice.zoneOperations().get(project=\"example-project\", zone=\"us-central1-a\", operation=\"example-operation\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapoolupdater.zoneOperations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapoolupdater.v1beta1\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.Replicapoolupdater.v1beta1;\r\nusing Google.Apis.Replicapoolupdater.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolupdaterSample\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 replicapoolupdaterService = new ReplicapoolupdaterService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = replicapoolupdaterService.ZoneOperations.Get(\"example-project\", \"us-central1-a\", \"example-operation\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/replicapoolupdater.zoneOperations.list.snippet.json b/replicapoolupdater.zoneOperations.list.snippet.json new file mode 100644 index 0000000..f4ef348 --- /dev/null +++ b/replicapoolupdater.zoneOperations.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"replicapoolupdater","apiVersion":"v1beta1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for replicapoolupdater.zoneOperations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/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/replicapoolupdater/v1beta1/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.replicapoolupdater.Replicapoolupdater;\r\nimport com.google.api.services.replicapoolupdater.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ReplicapoolupdaterSample {\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\tReplicapoolupdater replicapoolupdaterService = new Replicapoolupdater.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\tOperationList response;\r\n\t\tReplicapoolupdater.ZoneOperations.List request = replicapoolupdaterService.zoneOperations().list(\"example-project\", \"us-central1-a\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Operation item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for replicapoolupdater.zoneOperations.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/replicapoolupdater/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 'replicapoolupdater' service, at version 'v1beta1'.\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('replicapoolupdater', 'v1beta1', credentials=credentials)\r\n\r\nrequest = service.zoneOperations().list(project=\"example-project\", zone=\"us-central1-a\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.zoneOperations().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for replicapoolupdater.zoneOperations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable replicapoolupdater Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/replicapoolupdater/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.replicapoolupdater.v1beta1\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.Replicapoolupdater.v1beta1;\r\nusing Google.Apis.Replicapoolupdater.v1beta1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ReplicapoolupdaterSample\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 replicapoolupdaterService = new ReplicapoolupdaterService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n OperationList response;\r\n var request = replicapoolupdaterService.ZoneOperations.List(\"example-project\", \"us-central1-a\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/resourceviews.zoneOperations.get.snippet.json b/resourceviews.zoneOperations.get.snippet.json new file mode 100644 index 0000000..05cbec5 --- /dev/null +++ b/resourceviews.zoneOperations.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"resourceviews","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for resourceviews.zoneOperations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/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/resourceviews/v1beta2/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.resourceviews.Resourceviews;\r\nimport com.google.api.services.resourceviews.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ResourceviewsSample {\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\tResourceviews resourceviewsService = new Resourceviews.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\tResourceviews.ZoneOperations.Get request = resourceviewsService.zoneOperations().get(\"example-project\", \"us-central1-a\", \"example-operation\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for resourceviews.zoneOperations.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable resourceviews Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/resourceviews/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 'resourceviews' service, at version 'v1beta2'.\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('resourceviews', 'v1beta2', credentials=credentials)\r\n\r\nservice.zoneOperations().get(project=\"example-project\", zone=\"us-central1-a\", operation=\"example-operation\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for resourceviews.zoneOperations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.resourceviews.v1beta2\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.Resourceviews.v1beta2;\r\nusing Google.Apis.Resourceviews.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ResourceviewsSample\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 resourceviewsService = new ResourceviewsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = resourceviewsService.ZoneOperations.Get(\"example-project\", \"us-central1-a\", \"example-operation\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/resourceviews.zoneOperations.list.snippet.json b/resourceviews.zoneOperations.list.snippet.json new file mode 100644 index 0000000..f6865f0 --- /dev/null +++ b/resourceviews.zoneOperations.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"resourceviews","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for resourceviews.zoneOperations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/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/resourceviews/v1beta2/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.resourceviews.Resourceviews;\r\nimport com.google.api.services.resourceviews.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ResourceviewsSample {\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\tResourceviews resourceviewsService = new Resourceviews.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\tOperationList response;\r\n\t\tResourceviews.ZoneOperations.List request = resourceviewsService.zoneOperations().list(\"example-project\", \"us-central1-a\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Operation item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for resourceviews.zoneOperations.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable resourceviews Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/resourceviews/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 'resourceviews' service, at version 'v1beta2'.\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('resourceviews', 'v1beta2', credentials=credentials)\r\n\r\nrequest = service.zoneOperations().list(project=\"example-project\", zone=\"us-central1-a\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.zoneOperations().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for resourceviews.zoneOperations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.resourceviews.v1beta2\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.Resourceviews.v1beta2;\r\nusing Google.Apis.Resourceviews.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ResourceviewsSample\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 resourceviewsService = new ResourceviewsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n OperationList response;\r\n var request = resourceviewsService.ZoneOperations.List(\"example-project\", \"us-central1-a\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/resourceviews.zoneViews.addResources.snippet.json b/resourceviews.zoneViews.addResources.snippet.json new file mode 100644 index 0000000..f8afd96 --- /dev/null +++ b/resourceviews.zoneViews.addResources.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"resourceviews","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for resourceviews.zoneViews.addResources\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/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/resourceviews/v1beta2/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.resourceviews.Resourceviews;\r\nimport com.google.api.services.resourceviews.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ResourceviewsSample {\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\tResourceviews resourceviewsService = new Resourceviews.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\tZoneViewsAddResourcesRequest zoneViewsAddResourcesRequest = new ZoneViewsAddResourcesRequest();\r\n\t\t// Add your code to populate the zoneViewsAddResourcesRequest object\r\n\t\tResourceviews.ZoneViews.AddResources call = resourceviewsService.zoneViews().addResources(\"example-project\", \"us-central1-a\", \"example-resourceView\", zoneViewsAddResourcesRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for resourceviews.zoneViews.addResources\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable resourceviews Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/resourceviews/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 'resourceviews' service, at version 'v1beta2'.\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('resourceviews', 'v1beta2', credentials=credentials)\r\n\r\nzone_views_add_resources_request = {} # construct your object here\r\nrequest = service.zoneViews().addResources(body=zone_views_add_resources_request, project=\"example-project\", zone=\"us-central1-a\", resourceView=\"example-resourceView\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for resourceviews.zoneViews.addResources\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.resourceviews.v1beta2\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.Resourceviews.v1beta2;\r\nusing Google.Apis.Resourceviews.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ResourceviewsSample\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 resourceviewsService = new ResourceviewsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var zoneViewsAddResourcesRequest = new ZoneViewsAddResourcesRequest();\r\n // Add your code to populate the zoneViewsAddResourcesRequest object\r\n var call = resourceviewsService.ZoneViews.AddResources(zoneViewsAddResourcesRequest, \"example-project\", \"us-central1-a\", \"example-resourceView\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/resourceviews.zoneViews.delete.snippet.json b/resourceviews.zoneViews.delete.snippet.json new file mode 100644 index 0000000..2b839b3 --- /dev/null +++ b/resourceviews.zoneViews.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"resourceviews","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for resourceviews.zoneViews.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/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/resourceviews/v1beta2/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.resourceviews.Resourceviews;\r\nimport com.google.api.services.resourceviews.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ResourceviewsSample {\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\tResourceviews resourceviewsService = new Resourceviews.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\tResourceviews.ZoneViews.Delete request = resourceviewsService.zoneViews().delete(\"example-project\", \"us-central1-a\", \"example-resourceView\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for resourceviews.zoneViews.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable resourceviews Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/resourceviews/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 'resourceviews' service, at version 'v1beta2'.\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('resourceviews', 'v1beta2', credentials=credentials)\r\n\r\nservice.zoneViews().delete(project=\"example-project\", zone=\"us-central1-a\", resourceView=\"example-resourceView\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for resourceviews.zoneViews.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.resourceviews.v1beta2\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.Resourceviews.v1beta2;\r\nusing Google.Apis.Resourceviews.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ResourceviewsSample\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 resourceviewsService = new ResourceviewsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = resourceviewsService.ZoneViews.Delete(\"example-project\", \"us-central1-a\", \"example-resourceView\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/resourceviews.zoneViews.get.snippet.json b/resourceviews.zoneViews.get.snippet.json new file mode 100644 index 0000000..fbf16e0 --- /dev/null +++ b/resourceviews.zoneViews.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"resourceviews","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for resourceviews.zoneViews.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/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/resourceviews/v1beta2/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.resourceviews.Resourceviews;\r\nimport com.google.api.services.resourceviews.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ResourceviewsSample {\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\tResourceviews resourceviewsService = new Resourceviews.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\tResourceviews.ZoneViews.Get request = resourceviewsService.zoneViews().get(\"example-project\", \"us-central1-a\", \"example-resourceView\");\r\n\t\tResourceView response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for resourceviews.zoneViews.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable resourceviews Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/resourceviews/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 'resourceviews' service, at version 'v1beta2'.\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('resourceviews', 'v1beta2', credentials=credentials)\r\n\r\nservice.zoneViews().get(project=\"example-project\", zone=\"us-central1-a\", resourceView=\"example-resourceView\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for resourceviews.zoneViews.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.resourceviews.v1beta2\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.Resourceviews.v1beta2;\r\nusing Google.Apis.Resourceviews.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ResourceviewsSample\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 resourceviewsService = new ResourceviewsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = resourceviewsService.ZoneViews.Get(\"example-project\", \"us-central1-a\", \"example-resourceView\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/resourceviews.zoneViews.getService.snippet.json b/resourceviews.zoneViews.getService.snippet.json new file mode 100644 index 0000000..3e82469 --- /dev/null +++ b/resourceviews.zoneViews.getService.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"resourceviews","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for resourceviews.zoneViews.getService\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/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/resourceviews/v1beta2/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.resourceviews.Resourceviews;\r\nimport com.google.api.services.resourceviews.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ResourceviewsSample {\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\tResourceviews resourceviewsService = new Resourceviews.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\tResourceviews.ZoneViews.GetService request = resourceviewsService.zoneViews().getService(\"example-project\", \"us-central1-a\", \"example-resourceView\");\r\n\t\tZoneViewsGetServiceResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for resourceviews.zoneViews.getService\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable resourceviews Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/resourceviews/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 'resourceviews' service, at version 'v1beta2'.\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('resourceviews', 'v1beta2', credentials=credentials)\r\n\r\nservice.zoneViews().getService(project=\"example-project\", zone=\"us-central1-a\", resourceView=\"example-resourceView\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for resourceviews.zoneViews.getService\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.resourceviews.v1beta2\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.Resourceviews.v1beta2;\r\nusing Google.Apis.Resourceviews.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ResourceviewsSample\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 resourceviewsService = new ResourceviewsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = resourceviewsService.ZoneViews.GetService(\"example-project\", \"us-central1-a\", \"example-resourceView\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/resourceviews.zoneViews.insert.snippet.json b/resourceviews.zoneViews.insert.snippet.json new file mode 100644 index 0000000..f98176d --- /dev/null +++ b/resourceviews.zoneViews.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"resourceviews","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for resourceviews.zoneViews.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/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/resourceviews/v1beta2/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.resourceviews.Resourceviews;\r\nimport com.google.api.services.resourceviews.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ResourceviewsSample {\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\tResourceviews resourceviewsService = new Resourceviews.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\tResourceView resourceView = new ResourceView();\r\n\t\t// Add your code to populate the resourceView object\r\n\t\tResourceviews.ZoneViews.Insert call = resourceviewsService.zoneViews().insert(\"example-project\", \"us-central1-a\", resourceView);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for resourceviews.zoneViews.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable resourceviews Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/resourceviews/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 'resourceviews' service, at version 'v1beta2'.\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('resourceviews', 'v1beta2', credentials=credentials)\r\n\r\nresource_view = {} # construct your object here\r\nrequest = service.zoneViews().insert(body=resource_view, project=\"example-project\", zone=\"us-central1-a\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for resourceviews.zoneViews.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.resourceviews.v1beta2\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.Resourceviews.v1beta2;\r\nusing Google.Apis.Resourceviews.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ResourceviewsSample\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 resourceviewsService = new ResourceviewsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var resourceView = new ResourceView();\r\n // Add your code to populate the resourceView object\r\n var call = resourceviewsService.ZoneViews.Insert(resourceView, \"example-project\", \"us-central1-a\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/resourceviews.zoneViews.list.snippet.json b/resourceviews.zoneViews.list.snippet.json new file mode 100644 index 0000000..c57cf5b --- /dev/null +++ b/resourceviews.zoneViews.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"resourceviews","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for resourceviews.zoneViews.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/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/resourceviews/v1beta2/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.resourceviews.Resourceviews;\r\nimport com.google.api.services.resourceviews.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ResourceviewsSample {\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\tResourceviews resourceviewsService = new Resourceviews.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\tZoneViewsList response;\r\n\t\tResourceviews.ZoneViews.List request = resourceviewsService.zoneViews().list(\"example-project\", \"us-central1-a\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (ResourceView item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for resourceviews.zoneViews.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable resourceviews Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/resourceviews/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 'resourceviews' service, at version 'v1beta2'.\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('resourceviews', 'v1beta2', credentials=credentials)\r\n\r\nrequest = service.zoneViews().list(project=\"example-project\", zone=\"us-central1-a\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.zoneViews().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for resourceviews.zoneViews.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.resourceviews.v1beta2\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.Resourceviews.v1beta2;\r\nusing Google.Apis.Resourceviews.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ResourceviewsSample\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 resourceviewsService = new ResourceviewsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ZoneViewsList response;\r\n var request = resourceviewsService.ZoneViews.List(\"example-project\", \"us-central1-a\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/resourceviews.zoneViews.listResources.snippet.json b/resourceviews.zoneViews.listResources.snippet.json new file mode 100644 index 0000000..250731c --- /dev/null +++ b/resourceviews.zoneViews.listResources.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"resourceviews","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for resourceviews.zoneViews.listResources\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/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/resourceviews/v1beta2/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.resourceviews.Resourceviews;\r\nimport com.google.api.services.resourceviews.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ResourceviewsSample {\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\tResourceviews resourceviewsService = new Resourceviews.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\tZoneViewsListResourcesResponse response;\r\n\t\tResourceviews.ZoneViews.ListResources request = resourceviewsService.zoneViews().listResources(\"example-project\", \"us-central1-a\", \"example-resourceView\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (ListResourceResponseItem item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for resourceviews.zoneViews.listResources\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable resourceviews Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/resourceviews/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 'resourceviews' service, at version 'v1beta2'.\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('resourceviews', 'v1beta2', credentials=credentials)\r\n\r\nrequest = service.zoneViews().listResources(project=\"example-project\", zone=\"us-central1-a\", resourceView=\"example-resourceView\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.zoneViews().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for resourceviews.zoneViews.listResources\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.resourceviews.v1beta2\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.Resourceviews.v1beta2;\r\nusing Google.Apis.Resourceviews.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ResourceviewsSample\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 resourceviewsService = new ResourceviewsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ZoneViewsListResourcesResponse response;\r\n var request = resourceviewsService.ZoneViews.ListResources(\"example-project\", \"us-central1-a\", \"example-resourceView\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/resourceviews.zoneViews.removeResources.snippet.json b/resourceviews.zoneViews.removeResources.snippet.json new file mode 100644 index 0000000..7f07a60 --- /dev/null +++ b/resourceviews.zoneViews.removeResources.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"resourceviews","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for resourceviews.zoneViews.removeResources\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/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/resourceviews/v1beta2/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.resourceviews.Resourceviews;\r\nimport com.google.api.services.resourceviews.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ResourceviewsSample {\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\tResourceviews resourceviewsService = new Resourceviews.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\tZoneViewsRemoveResourcesRequest zoneViewsRemoveResourcesRequest = new ZoneViewsRemoveResourcesRequest();\r\n\t\t// Add your code to populate the zoneViewsRemoveResourcesRequest object\r\n\t\tResourceviews.ZoneViews.RemoveResources call = resourceviewsService.zoneViews().removeResources(\"example-project\", \"us-central1-a\", \"example-resourceView\", zoneViewsRemoveResourcesRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for resourceviews.zoneViews.removeResources\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable resourceviews Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/resourceviews/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 'resourceviews' service, at version 'v1beta2'.\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('resourceviews', 'v1beta2', credentials=credentials)\r\n\r\nzone_views_remove_resources_request = {} # construct your object here\r\nrequest = service.zoneViews().removeResources(body=zone_views_remove_resources_request, project=\"example-project\", zone=\"us-central1-a\", resourceView=\"example-resourceView\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for resourceviews.zoneViews.removeResources\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.resourceviews.v1beta2\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.Resourceviews.v1beta2;\r\nusing Google.Apis.Resourceviews.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ResourceviewsSample\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 resourceviewsService = new ResourceviewsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var zoneViewsRemoveResourcesRequest = new ZoneViewsRemoveResourcesRequest();\r\n // Add your code to populate the zoneViewsRemoveResourcesRequest object\r\n var call = resourceviewsService.ZoneViews.RemoveResources(zoneViewsRemoveResourcesRequest, \"example-project\", \"us-central1-a\", \"example-resourceView\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/resourceviews.zoneViews.setService.snippet.json b/resourceviews.zoneViews.setService.snippet.json new file mode 100644 index 0000000..89baf27 --- /dev/null +++ b/resourceviews.zoneViews.setService.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"resourceviews","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for resourceviews.zoneViews.setService\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/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/resourceviews/v1beta2/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.resourceviews.Resourceviews;\r\nimport com.google.api.services.resourceviews.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class ResourceviewsSample {\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\tResourceviews resourceviewsService = new Resourceviews.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\tZoneViewsSetServiceRequest zoneViewsSetServiceRequest = new ZoneViewsSetServiceRequest();\r\n\t\t// Add your code to populate the zoneViewsSetServiceRequest object\r\n\t\tResourceviews.ZoneViews.SetService call = resourceviewsService.zoneViews().setService(\"example-project\", \"us-central1-a\", \"example-resourceView\", zoneViewsSetServiceRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for resourceviews.zoneViews.setService\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable resourceviews Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/resourceviews/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 'resourceviews' service, at version 'v1beta2'.\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('resourceviews', 'v1beta2', credentials=credentials)\r\n\r\nzone_views_set_service_request = {} # construct your object here\r\nrequest = service.zoneViews().setService(body=zone_views_set_service_request, project=\"example-project\", zone=\"us-central1-a\", resourceView=\"example-resourceView\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for resourceviews.zoneViews.setService\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable resourceviews Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/resourceviews/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.resourceviews.v1beta2\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.Resourceviews.v1beta2;\r\nusing Google.Apis.Resourceviews.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass ResourceviewsSample\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 resourceviewsService = new ResourceviewsService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var zoneViewsSetServiceRequest = new ZoneViewsSetServiceRequest();\r\n // Add your code to populate the zoneViewsSetServiceRequest object\r\n var call = resourceviewsService.ZoneViews.SetService(zoneViewsSetServiceRequest, \"example-project\", \"us-central1-a\", \"example-resourceView\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.backupRuns.delete.snippet.json b/sql.backupRuns.delete.snippet.json new file mode 100644 index 0000000..3777868 --- /dev/null +++ b/sql.backupRuns.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.backupRuns.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.BackupRuns.Delete request = sqladminService.backupRuns().delete(\"example-project\", \"debian-instance-1\", \"example-id\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.backupRuns.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.backupRuns().delete(project=\"example-project\", instance=\"debian-instance-1\", id=\"example-id\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.backupRuns.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.BackupRuns.Delete(\"example-project\", \"debian-instance-1\", \"example-id\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.backupRuns.get.snippet.json b/sql.backupRuns.get.snippet.json new file mode 100644 index 0000000..1f352e5 --- /dev/null +++ b/sql.backupRuns.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.backupRuns.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.BackupRuns.Get request = sqladminService.backupRuns().get(\"example-project\", \"debian-instance-1\", \"example-id\");\r\n\t\tBackupRun response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.backupRuns.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.backupRuns().get(project=\"example-project\", instance=\"debian-instance-1\", id=\"example-id\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.backupRuns.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.BackupRuns.Get(\"example-project\", \"debian-instance-1\", \"example-id\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.backupRuns.list.snippet.json b/sql.backupRuns.list.snippet.json new file mode 100644 index 0000000..81ad26f --- /dev/null +++ b/sql.backupRuns.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.backupRuns.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tBackupRunsListResponse response;\r\n\t\tSqladmin.BackupRuns.List request = sqladminService.backupRuns().list(\"example-project\", \"debian-instance-1\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (BackupRun item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for sql.backupRuns.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nrequest = service.backupRuns().list(project=\"example-project\", instance=\"debian-instance-1\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.backupRuns().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.backupRuns.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n BackupRunsListResponse response;\r\n var request = sqladminService.BackupRuns.List(\"example-project\", \"debian-instance-1\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.databases.delete.snippet.json b/sql.databases.delete.snippet.json new file mode 100644 index 0000000..580e8ee --- /dev/null +++ b/sql.databases.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.databases.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.Databases.Delete request = sqladminService.databases().delete(\"example-project\", \"debian-instance-1\", \"example-database\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.databases.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.databases().delete(project=\"example-project\", instance=\"debian-instance-1\", database=\"example-database\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.databases.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.Databases.Delete(\"example-project\", \"debian-instance-1\", \"example-database\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.databases.get.snippet.json b/sql.databases.get.snippet.json new file mode 100644 index 0000000..6d2d17c --- /dev/null +++ b/sql.databases.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.databases.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.Databases.Get request = sqladminService.databases().get(\"example-project\", \"debian-instance-1\", \"example-database\");\r\n\t\tDatabase response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.databases.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.databases().get(project=\"example-project\", instance=\"debian-instance-1\", database=\"example-database\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.databases.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.Databases.Get(\"example-project\", \"debian-instance-1\", \"example-database\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.databases.insert.snippet.json b/sql.databases.insert.snippet.json new file mode 100644 index 0000000..3bcfdb5 --- /dev/null +++ b/sql.databases.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.databases.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tDatabase database = new Database();\r\n\t\t// Add your code to populate the database object\r\n\t\tSqladmin.Databases.Insert call = sqladminService.databases().insert(\"example-project\", \"debian-instance-1\", database);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.databases.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\ndatabase = {} # construct your object here\r\nrequest = service.databases().insert(body=database, project=\"example-project\", instance=\"debian-instance-1\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.databases.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var database = new Database();\r\n // Add your code to populate the database object\r\n var call = sqladminService.Databases.Insert(database, \"example-project\", \"debian-instance-1\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.databases.list.snippet.json b/sql.databases.list.snippet.json new file mode 100644 index 0000000..9a25ea3 --- /dev/null +++ b/sql.databases.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.databases.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.Databases.List request = sqladminService.databases().list(\"example-project\", \"debian-instance-1\");\r\n\t\tDatabasesListResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.databases.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.databases().list(project=\"example-project\", instance=\"debian-instance-1\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.databases.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.Databases.List(\"example-project\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.databases.patch.snippet.json b/sql.databases.patch.snippet.json new file mode 100644 index 0000000..47a480f --- /dev/null +++ b/sql.databases.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.databases.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\t// Obtain the Database object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tSqladmin.Databases.Patch request = sqladminService.databases().patch(\"example-project\", \"debian-instance-1\", \"example-database\", database);\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.databases.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\n# Obtain the database object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.databases().patch(body=database, project=\"example-project\", instance=\"debian-instance-1\", database=\"example-database\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.databases.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the Database object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = sqladminService.Databases.Patch(database, \"example-project\", \"debian-instance-1\", \"example-database\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.databases.update.snippet.json b/sql.databases.update.snippet.json new file mode 100644 index 0000000..ef3c5e1 --- /dev/null +++ b/sql.databases.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.databases.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tDatabase database = new Database();\r\n\t\t// Add your code to populate the database object\r\n\t\tSqladmin.Databases.Update call = sqladminService.databases().update(\"example-project\", \"debian-instance-1\", \"example-database\", database);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.databases.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\ndatabase = {} # construct your object here\r\nrequest = service.databases().update(body=database, project=\"example-project\", instance=\"debian-instance-1\", database=\"example-database\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.databases.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var database = new Database();\r\n // Add your code to populate the database object\r\n var call = sqladminService.Databases.Update(database, \"example-project\", \"debian-instance-1\", \"example-database\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.flags.list.snippet.json b/sql.flags.list.snippet.json new file mode 100644 index 0000000..3a9c916 --- /dev/null +++ b/sql.flags.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.flags.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.Flags.List request = sqladminService.flags().list();\r\n\t\tFlagsListResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.flags.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.flags().list().execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.flags.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.Flags.List();\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.instances.clone.snippet.json b/sql.instances.clone.snippet.json new file mode 100644 index 0000000..107f170 --- /dev/null +++ b/sql.instances.clone.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.instances.clone\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tInstancesCloneRequest instancesCloneRequest = new InstancesCloneRequest();\r\n\t\t// Add your code to populate the instancesCloneRequest object\r\n\t\tSqladmin.Instances.Clone call = sqladminService.instances().clone(\"example-project\", \"debian-instance-1\", instancesCloneRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.instances.clone\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\ninstances_clone_request = {} # construct your object here\r\nrequest = service.instances().clone(body=instances_clone_request, project=\"example-project\", instance=\"debian-instance-1\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.instances.clone\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instancesCloneRequest = new InstancesCloneRequest();\r\n // Add your code to populate the instancesCloneRequest object\r\n var call = sqladminService.Instances.Clone(instancesCloneRequest, \"example-project\", \"debian-instance-1\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.instances.delete.snippet.json b/sql.instances.delete.snippet.json new file mode 100644 index 0000000..f506c1b --- /dev/null +++ b/sql.instances.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.instances.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.Instances.Delete request = sqladminService.instances().delete(\"example-project\", \"debian-instance-1\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.instances.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.instances().delete(project=\"example-project\", instance=\"debian-instance-1\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.instances.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.Instances.Delete(\"example-project\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.instances.export.snippet.json b/sql.instances.export.snippet.json new file mode 100644 index 0000000..6e8cc62 --- /dev/null +++ b/sql.instances.export.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.instances.export\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tInstancesExportRequest instancesExportRequest = new InstancesExportRequest();\r\n\t\t// Add your code to populate the instancesExportRequest object\r\n\t\tSqladmin.Instances.Export call = sqladminService.instances().export(\"example-project\", \"debian-instance-1\", instancesExportRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.instances.export\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\ninstances_export_request = {} # construct your object here\r\nrequest = service.instances().export(body=instances_export_request, project=\"example-project\", instance=\"debian-instance-1\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.instances.export\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instancesExportRequest = new InstancesExportRequest();\r\n // Add your code to populate the instancesExportRequest object\r\n var call = sqladminService.Instances.Export(instancesExportRequest, \"example-project\", \"debian-instance-1\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.instances.failover.snippet.json b/sql.instances.failover.snippet.json new file mode 100644 index 0000000..7bd3f45 --- /dev/null +++ b/sql.instances.failover.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.instances.failover\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tInstancesFailoverRequest instancesFailoverRequest = new InstancesFailoverRequest();\r\n\t\t// Add your code to populate the instancesFailoverRequest object\r\n\t\tSqladmin.Instances.Failover call = sqladminService.instances().failover(\"example-project\", \"debian-instance-1\", instancesFailoverRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.instances.failover\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\ninstances_failover_request = {} # construct your object here\r\nrequest = service.instances().failover(body=instances_failover_request, project=\"example-project\", instance=\"debian-instance-1\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.instances.failover\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instancesFailoverRequest = new InstancesFailoverRequest();\r\n // Add your code to populate the instancesFailoverRequest object\r\n var call = sqladminService.Instances.Failover(instancesFailoverRequest, \"example-project\", \"debian-instance-1\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.instances.get.snippet.json b/sql.instances.get.snippet.json new file mode 100644 index 0000000..f556d34 --- /dev/null +++ b/sql.instances.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.instances.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.Instances.Get request = sqladminService.instances().get(\"example-project\", \"debian-instance-1\");\r\n\t\tDatabaseInstance response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.instances.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.instances().get(project=\"example-project\", instance=\"debian-instance-1\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.instances.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.Instances.Get(\"example-project\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.instances.import.snippet.json b/sql.instances.import.snippet.json new file mode 100644 index 0000000..40f0bbc --- /dev/null +++ b/sql.instances.import.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.instances.import\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tInstancesImportRequest instancesImportRequest = new InstancesImportRequest();\r\n\t\t// Add your code to populate the instancesImportRequest object\r\n\t\tSqladmin.Instances.Import call = sqladminService.instances().import(\"example-project\", \"debian-instance-1\", instancesImportRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.instances.import\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\ninstances_import_request = {} # construct your object here\r\nrequest = service.instances().import(body=instances_import_request, project=\"example-project\", instance=\"debian-instance-1\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.instances.import\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instancesImportRequest = new InstancesImportRequest();\r\n // Add your code to populate the instancesImportRequest object\r\n var call = sqladminService.Instances.Import(instancesImportRequest, \"example-project\", \"debian-instance-1\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.instances.insert.snippet.json b/sql.instances.insert.snippet.json new file mode 100644 index 0000000..8fe59de --- /dev/null +++ b/sql.instances.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.instances.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tDatabaseInstance databaseInstance = new DatabaseInstance();\r\n\t\t// Add your code to populate the databaseInstance object\r\n\t\tSqladmin.Instances.Insert call = sqladminService.instances().insert(\"example-project\", databaseInstance);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.instances.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\ndatabase_instance = {} # construct your object here\r\nrequest = service.instances().insert(body=database_instance, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.instances.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var databaseInstance = new DatabaseInstance();\r\n // Add your code to populate the databaseInstance object\r\n var call = sqladminService.Instances.Insert(databaseInstance, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.instances.list.snippet.json b/sql.instances.list.snippet.json new file mode 100644 index 0000000..e55c014 --- /dev/null +++ b/sql.instances.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.instances.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tInstancesListResponse response;\r\n\t\tSqladmin.Instances.List request = sqladminService.instances().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (DatabaseInstance item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for sql.instances.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nrequest = service.instances().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.instances().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.instances.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n InstancesListResponse response;\r\n var request = sqladminService.Instances.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.instances.patch.snippet.json b/sql.instances.patch.snippet.json new file mode 100644 index 0000000..2202cfe --- /dev/null +++ b/sql.instances.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.instances.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\t// Obtain the DatabaseInstance object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tSqladmin.Instances.Patch request = sqladminService.instances().patch(\"example-project\", \"debian-instance-1\", databaseInstance);\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.instances.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\n# Obtain the database_instance object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.instances().patch(body=database_instance, project=\"example-project\", instance=\"debian-instance-1\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.instances.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the DatabaseInstance object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = sqladminService.Instances.Patch(databaseInstance, \"example-project\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.instances.promoteReplica.snippet.json b/sql.instances.promoteReplica.snippet.json new file mode 100644 index 0000000..dd60ee7 --- /dev/null +++ b/sql.instances.promoteReplica.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.instances.promoteReplica\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.Instances.PromoteReplica request = sqladminService.instances().promoteReplica(\"example-project\", \"debian-instance-1\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.instances.promoteReplica\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.instances().promoteReplica(project=\"example-project\", instance=\"debian-instance-1\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.instances.promoteReplica\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.Instances.PromoteReplica(\"example-project\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.instances.resetSslConfig.snippet.json b/sql.instances.resetSslConfig.snippet.json new file mode 100644 index 0000000..4f04c3a --- /dev/null +++ b/sql.instances.resetSslConfig.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.instances.resetSslConfig\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.Instances.ResetSslConfig request = sqladminService.instances().resetSslConfig(\"example-project\", \"debian-instance-1\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.instances.resetSslConfig\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.instances().resetSslConfig(project=\"example-project\", instance=\"debian-instance-1\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.instances.resetSslConfig\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.Instances.ResetSslConfig(\"example-project\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.instances.restart.snippet.json b/sql.instances.restart.snippet.json new file mode 100644 index 0000000..e17549e --- /dev/null +++ b/sql.instances.restart.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.instances.restart\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.Instances.Restart request = sqladminService.instances().restart(\"example-project\", \"debian-instance-1\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.instances.restart\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.instances().restart(project=\"example-project\", instance=\"debian-instance-1\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.instances.restart\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.Instances.Restart(\"example-project\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.instances.restoreBackup.snippet.json b/sql.instances.restoreBackup.snippet.json new file mode 100644 index 0000000..249c60e --- /dev/null +++ b/sql.instances.restoreBackup.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.instances.restoreBackup\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tInstancesRestoreBackupRequest instancesRestoreBackupRequest = new InstancesRestoreBackupRequest();\r\n\t\t// Add your code to populate the instancesRestoreBackupRequest object\r\n\t\tSqladmin.Instances.RestoreBackup call = sqladminService.instances().restoreBackup(\"example-project\", \"debian-instance-1\", instancesRestoreBackupRequest);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.instances.restoreBackup\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\ninstances_restore_backup_request = {} # construct your object here\r\nrequest = service.instances().restoreBackup(body=instances_restore_backup_request, project=\"example-project\", instance=\"debian-instance-1\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.instances.restoreBackup\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var instancesRestoreBackupRequest = new InstancesRestoreBackupRequest();\r\n // Add your code to populate the instancesRestoreBackupRequest object\r\n var call = sqladminService.Instances.RestoreBackup(instancesRestoreBackupRequest, \"example-project\", \"debian-instance-1\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.instances.startReplica.snippet.json b/sql.instances.startReplica.snippet.json new file mode 100644 index 0000000..26e54a1 --- /dev/null +++ b/sql.instances.startReplica.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.instances.startReplica\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.Instances.StartReplica request = sqladminService.instances().startReplica(\"example-project\", \"debian-instance-1\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.instances.startReplica\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.instances().startReplica(project=\"example-project\", instance=\"debian-instance-1\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.instances.startReplica\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.Instances.StartReplica(\"example-project\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.instances.stopReplica.snippet.json b/sql.instances.stopReplica.snippet.json new file mode 100644 index 0000000..be03bae --- /dev/null +++ b/sql.instances.stopReplica.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.instances.stopReplica\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.Instances.StopReplica request = sqladminService.instances().stopReplica(\"example-project\", \"debian-instance-1\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.instances.stopReplica\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.instances().stopReplica(project=\"example-project\", instance=\"debian-instance-1\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.instances.stopReplica\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.Instances.StopReplica(\"example-project\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.instances.update.snippet.json b/sql.instances.update.snippet.json new file mode 100644 index 0000000..42de81b --- /dev/null +++ b/sql.instances.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.instances.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tDatabaseInstance databaseInstance = new DatabaseInstance();\r\n\t\t// Add your code to populate the databaseInstance object\r\n\t\tSqladmin.Instances.Update call = sqladminService.instances().update(\"example-project\", \"debian-instance-1\", databaseInstance);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.instances.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\ndatabase_instance = {} # construct your object here\r\nrequest = service.instances().update(body=database_instance, project=\"example-project\", instance=\"debian-instance-1\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.instances.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var databaseInstance = new DatabaseInstance();\r\n // Add your code to populate the databaseInstance object\r\n var call = sqladminService.Instances.Update(databaseInstance, \"example-project\", \"debian-instance-1\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.operations.get.snippet.json b/sql.operations.get.snippet.json new file mode 100644 index 0000000..080bff5 --- /dev/null +++ b/sql.operations.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.operations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.Operations.Get request = sqladminService.operations().get(\"example-project\", \"example-operation\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.operations.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.operations().get(project=\"example-project\", operation=\"example-operation\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.operations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.Operations.Get(\"example-project\", \"example-operation\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.operations.list.snippet.json b/sql.operations.list.snippet.json new file mode 100644 index 0000000..bf290be --- /dev/null +++ b/sql.operations.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.operations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tOperationsListResponse response;\r\n\t\tSqladmin.Operations.List request = sqladminService.operations().list(\"example-project\", \"debian-instance-1\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Operation item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for sql.operations.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nrequest = service.operations().list(project=\"example-project\", instance=\"debian-instance-1\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.operations().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.operations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n OperationsListResponse response;\r\n var request = sqladminService.Operations.List(\"example-project\", \"debian-instance-1\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.sslCerts.createEphemeral.snippet.json b/sql.sslCerts.createEphemeral.snippet.json new file mode 100644 index 0000000..4ed47c1 --- /dev/null +++ b/sql.sslCerts.createEphemeral.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.sslCerts.createEphemeral\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSslCertsCreateEphemeralRequest sslCertsCreateEphemeralRequest = new SslCertsCreateEphemeralRequest();\r\n\t\t// Add your code to populate the sslCertsCreateEphemeralRequest object\r\n\t\tSqladmin.SslCerts.CreateEphemeral call = sqladminService.sslCerts().createEphemeral(\"example-project\", \"debian-instance-1\", sslCertsCreateEphemeralRequest);\r\n\t\tSslCert response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.sslCerts.createEphemeral\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nssl_certs_create_ephemeral_request = {} # construct your object here\r\nrequest = service.sslCerts().createEphemeral(body=ssl_certs_create_ephemeral_request, project=\"example-project\", instance=\"debian-instance-1\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.sslCerts.createEphemeral\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var sslCertsCreateEphemeralRequest = new SslCertsCreateEphemeralRequest();\r\n // Add your code to populate the sslCertsCreateEphemeralRequest object\r\n var call = sqladminService.SslCerts.CreateEphemeral(sslCertsCreateEphemeralRequest, \"example-project\", \"debian-instance-1\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.sslCerts.delete.snippet.json b/sql.sslCerts.delete.snippet.json new file mode 100644 index 0000000..04532f8 --- /dev/null +++ b/sql.sslCerts.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.sslCerts.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.SslCerts.Delete request = sqladminService.sslCerts().delete(\"example-project\", \"debian-instance-1\", \"example-sha1Fingerprint\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.sslCerts.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.sslCerts().delete(project=\"example-project\", instance=\"debian-instance-1\", sha1Fingerprint=\"example-sha1Fingerprint\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.sslCerts.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.SslCerts.Delete(\"example-project\", \"debian-instance-1\", \"example-sha1Fingerprint\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.sslCerts.get.snippet.json b/sql.sslCerts.get.snippet.json new file mode 100644 index 0000000..2b5ec11 --- /dev/null +++ b/sql.sslCerts.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.sslCerts.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.SslCerts.Get request = sqladminService.sslCerts().get(\"example-project\", \"debian-instance-1\", \"example-sha1Fingerprint\");\r\n\t\tSslCert response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.sslCerts.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.sslCerts().get(project=\"example-project\", instance=\"debian-instance-1\", sha1Fingerprint=\"example-sha1Fingerprint\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.sslCerts.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.SslCerts.Get(\"example-project\", \"debian-instance-1\", \"example-sha1Fingerprint\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.sslCerts.insert.snippet.json b/sql.sslCerts.insert.snippet.json new file mode 100644 index 0000000..9b6f8ee --- /dev/null +++ b/sql.sslCerts.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.sslCerts.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSslCertsInsertRequest sslCertsInsertRequest = new SslCertsInsertRequest();\r\n\t\t// Add your code to populate the sslCertsInsertRequest object\r\n\t\tSqladmin.SslCerts.Insert call = sqladminService.sslCerts().insert(\"example-project\", \"debian-instance-1\", sslCertsInsertRequest);\r\n\t\tSslCertsInsertResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.sslCerts.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nssl_certs_insert_request = {} # construct your object here\r\nrequest = service.sslCerts().insert(body=ssl_certs_insert_request, project=\"example-project\", instance=\"debian-instance-1\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.sslCerts.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var sslCertsInsertRequest = new SslCertsInsertRequest();\r\n // Add your code to populate the sslCertsInsertRequest object\r\n var call = sqladminService.SslCerts.Insert(sslCertsInsertRequest, \"example-project\", \"debian-instance-1\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.sslCerts.list.snippet.json b/sql.sslCerts.list.snippet.json new file mode 100644 index 0000000..1503743 --- /dev/null +++ b/sql.sslCerts.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.sslCerts.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.SslCerts.List request = sqladminService.sslCerts().list(\"example-project\", \"debian-instance-1\");\r\n\t\tSslCertsListResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.sslCerts.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.sslCerts().list(project=\"example-project\", instance=\"debian-instance-1\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.sslCerts.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.SslCerts.List(\"example-project\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.tiers.list.snippet.json b/sql.tiers.list.snippet.json new file mode 100644 index 0000000..7e9df7f --- /dev/null +++ b/sql.tiers.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.tiers.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.Tiers.List request = sqladminService.tiers().list(\"example-project\");\r\n\t\tTiersListResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.tiers.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.tiers().list(project=\"example-project\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.tiers.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.Tiers.List(\"example-project\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.users.delete.snippet.json b/sql.users.delete.snippet.json new file mode 100644 index 0000000..4a63be0 --- /dev/null +++ b/sql.users.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.users.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.Users.Delete request = sqladminService.users().delete(\"example-project\", \"debian-instance-1\", \"example-host\", \"example-name\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.users.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.users().delete(project=\"example-project\", instance=\"debian-instance-1\", host=\"example-host\", name=\"example-name\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.users.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.Users.Delete(\"example-project\", \"debian-instance-1\", \"example-host\", \"example-name\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.users.insert.snippet.json b/sql.users.insert.snippet.json new file mode 100644 index 0000000..40f890a --- /dev/null +++ b/sql.users.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.users.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tUser user = new User();\r\n\t\t// Add your code to populate the user object\r\n\t\tSqladmin.Users.Insert call = sqladminService.users().insert(\"example-project\", \"debian-instance-1\", user);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.users.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nuser = {} # construct your object here\r\nrequest = service.users().insert(body=user, project=\"example-project\", instance=\"debian-instance-1\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.users.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var user = new User();\r\n // Add your code to populate the user object\r\n var call = sqladminService.Users.Insert(user, \"example-project\", \"debian-instance-1\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.users.list.snippet.json b/sql.users.list.snippet.json new file mode 100644 index 0000000..9e3d052 --- /dev/null +++ b/sql.users.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.users.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tSqladmin.Users.List request = sqladminService.users().list(\"example-project\", \"debian-instance-1\");\r\n\t\tUsersListResponse response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.users.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nservice.users().list(project=\"example-project\", instance=\"debian-instance-1\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.users.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = sqladminService.Users.List(\"example-project\", \"debian-instance-1\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/sql.users.update.snippet.json b/sql.users.update.snippet.json new file mode 100644 index 0000000..5986683 --- /dev/null +++ b/sql.users.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"sqladmin","apiVersion":"v1beta4","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for sql.users.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/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/sqladmin/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.sqladmin.Sqladmin;\r\nimport com.google.api.services.sqladmin.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class SqladminSample {\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\tSqladmin sqladminService = new Sqladmin.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\tUser user = new User();\r\n\t\t// Add your code to populate the user object\r\n\t\tSqladmin.Users.Update call = sqladminService.users().update(\"example-project\", \"debian-instance-1\", \"example-host\", \"example-name\", user);\r\n\t\tOperation response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for sql.users.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable sqladmin Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/sqladmin/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 'sqladmin' 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('sqladmin', 'v1beta4', credentials=credentials)\r\n\r\nuser = {} # construct your object here\r\nrequest = service.users().update(body=user, project=\"example-project\", instance=\"debian-instance-1\", host=\"example-host\", name=\"example-name\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for sql.users.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable sqladmin Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/sqladmin/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.sqladmin.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.Sqladmin.v1beta4;\r\nusing Google.Apis.Sqladmin.v1beta4.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass SqladminSample\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 sqladminService = new SqladminService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var user = new User();\r\n // Add your code to populate the user object\r\n var call = sqladminService.Users.Update(user, \"example-project\", \"debian-instance-1\", \"example-host\", \"example-name\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.bucketAccessControls.delete.snippet.json b/storage.bucketAccessControls.delete.snippet.json new file mode 100644 index 0000000..57748ce --- /dev/null +++ b/storage.bucketAccessControls.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.bucketAccessControls.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tStorage.BucketAccessControls.Delete request = storageService.bucketAccessControls().delete(\"example-bucket\", \"example-entity\");\r\n\t\t response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.bucketAccessControls.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nservice.bucketAccessControls().delete(bucket=\"example-bucket\", entity=\"example-entity\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.bucketAccessControls.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storageService.BucketAccessControls.Delete(\"example-bucket\", \"example-entity\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.bucketAccessControls.get.snippet.json b/storage.bucketAccessControls.get.snippet.json new file mode 100644 index 0000000..1f517d8 --- /dev/null +++ b/storage.bucketAccessControls.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.bucketAccessControls.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tStorage.BucketAccessControls.Get request = storageService.bucketAccessControls().get(\"example-bucket\", \"example-entity\");\r\n\t\tBucketAccessControl response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.bucketAccessControls.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nservice.bucketAccessControls().get(bucket=\"example-bucket\", entity=\"example-entity\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.bucketAccessControls.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storageService.BucketAccessControls.Get(\"example-bucket\", \"example-entity\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.bucketAccessControls.insert.snippet.json b/storage.bucketAccessControls.insert.snippet.json new file mode 100644 index 0000000..1e24a94 --- /dev/null +++ b/storage.bucketAccessControls.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.bucketAccessControls.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tBucketAccessControl bucketAccessControl = new BucketAccessControl();\r\n\t\t// Add your code to populate the bucketAccessControl object\r\n\t\tStorage.BucketAccessControls.Insert call = storageService.bucketAccessControls().insert(\"example-bucket\", bucketAccessControl);\r\n\t\tBucketAccessControl response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.bucketAccessControls.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nbucket_access_control = {} # construct your object here\r\nrequest = service.bucketAccessControls().insert(body=bucket_access_control, bucket=\"example-bucket\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.bucketAccessControls.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var bucketAccessControl = new BucketAccessControl();\r\n // Add your code to populate the bucketAccessControl object\r\n var call = storageService.BucketAccessControls.Insert(bucketAccessControl, \"example-bucket\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.bucketAccessControls.list.snippet.json b/storage.bucketAccessControls.list.snippet.json new file mode 100644 index 0000000..6e49524 --- /dev/null +++ b/storage.bucketAccessControls.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.bucketAccessControls.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tStorage.BucketAccessControls.List request = storageService.bucketAccessControls().list(\"example-bucket\");\r\n\t\tBucketAccessControls response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.bucketAccessControls.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nservice.bucketAccessControls().list(bucket=\"example-bucket\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.bucketAccessControls.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storageService.BucketAccessControls.List(\"example-bucket\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.bucketAccessControls.patch.snippet.json b/storage.bucketAccessControls.patch.snippet.json new file mode 100644 index 0000000..2cc350a --- /dev/null +++ b/storage.bucketAccessControls.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.bucketAccessControls.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\t// Obtain the BucketAccessControl object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tStorage.BucketAccessControls.Patch request = storageService.bucketAccessControls().patch(\"example-bucket\", \"example-entity\", bucketAccessControl);\r\n\t\tBucketAccessControl response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.bucketAccessControls.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\n# Obtain the bucket_access_control object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.bucketAccessControls().patch(body=bucket_access_control, bucket=\"example-bucket\", entity=\"example-entity\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.bucketAccessControls.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the BucketAccessControl object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = storageService.BucketAccessControls.Patch(bucketAccessControl, \"example-bucket\", \"example-entity\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.bucketAccessControls.update.snippet.json b/storage.bucketAccessControls.update.snippet.json new file mode 100644 index 0000000..beb9083 --- /dev/null +++ b/storage.bucketAccessControls.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.bucketAccessControls.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tBucketAccessControl bucketAccessControl = new BucketAccessControl();\r\n\t\t// Add your code to populate the bucketAccessControl object\r\n\t\tStorage.BucketAccessControls.Update call = storageService.bucketAccessControls().update(\"example-bucket\", \"example-entity\", bucketAccessControl);\r\n\t\tBucketAccessControl response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.bucketAccessControls.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nbucket_access_control = {} # construct your object here\r\nrequest = service.bucketAccessControls().update(body=bucket_access_control, bucket=\"example-bucket\", entity=\"example-entity\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.bucketAccessControls.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var bucketAccessControl = new BucketAccessControl();\r\n // Add your code to populate the bucketAccessControl object\r\n var call = storageService.BucketAccessControls.Update(bucketAccessControl, \"example-bucket\", \"example-entity\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.buckets.delete.snippet.json b/storage.buckets.delete.snippet.json new file mode 100644 index 0000000..353391a --- /dev/null +++ b/storage.buckets.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.buckets.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tStorage.Buckets.Delete request = storageService.buckets().delete(\"example-bucket\");\r\n\t\t response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.buckets.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nservice.buckets().delete(bucket=\"example-bucket\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.buckets.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storageService.Buckets.Delete(\"example-bucket\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.buckets.get.snippet.json b/storage.buckets.get.snippet.json new file mode 100644 index 0000000..c12226d --- /dev/null +++ b/storage.buckets.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.buckets.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tStorage.Buckets.Get request = storageService.buckets().get(\"example-bucket\");\r\n\t\tBucket response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.buckets.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nservice.buckets().get(bucket=\"example-bucket\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.buckets.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storageService.Buckets.Get(\"example-bucket\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.buckets.insert.snippet.json b/storage.buckets.insert.snippet.json new file mode 100644 index 0000000..3964513 --- /dev/null +++ b/storage.buckets.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.buckets.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tBucket bucket = new Bucket();\r\n\t\t// Add your code to populate the bucket object\r\n\t\tStorage.Buckets.Insert call = storageService.buckets().insert(\"example-project\", bucket);\r\n\t\tBucket response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.buckets.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nbucket = {} # construct your object here\r\nrequest = service.buckets().insert(body=bucket, project=\"example-project\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.buckets.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var bucket = new Bucket();\r\n // Add your code to populate the bucket object\r\n var call = storageService.Buckets.Insert(bucket, \"example-project\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.buckets.list.snippet.json b/storage.buckets.list.snippet.json new file mode 100644 index 0000000..5432472 --- /dev/null +++ b/storage.buckets.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.buckets.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tBuckets response;\r\n\t\tStorage.Buckets.List request = storageService.buckets().list(\"example-project\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Bucket item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for storage.buckets.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nrequest = service.buckets().list(project=\"example-project\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.buckets().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.buckets.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n Buckets response;\r\n var request = storageService.Buckets.List(\"example-project\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.buckets.patch.snippet.json b/storage.buckets.patch.snippet.json new file mode 100644 index 0000000..ae374df --- /dev/null +++ b/storage.buckets.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.buckets.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\t// Obtain the Bucket object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tStorage.Buckets.Patch request = storageService.buckets().patch(\"example-bucket\", bucket);\r\n\t\tBucket response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.buckets.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\n# Obtain the bucket object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.buckets().patch(body=bucket, bucket=\"example-bucket\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.buckets.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the Bucket object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = storageService.Buckets.Patch(bucket, \"example-bucket\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.buckets.update.snippet.json b/storage.buckets.update.snippet.json new file mode 100644 index 0000000..03459d8 --- /dev/null +++ b/storage.buckets.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.buckets.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tBucket bucket = new Bucket();\r\n\t\t// Add your code to populate the bucket object\r\n\t\tStorage.Buckets.Update call = storageService.buckets().update(\"example-bucket\", bucket);\r\n\t\tBucket response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.buckets.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nbucket = {} # construct your object here\r\nrequest = service.buckets().update(body=bucket, bucket=\"example-bucket\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.buckets.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var bucket = new Bucket();\r\n // Add your code to populate the bucket object\r\n var call = storageService.Buckets.Update(bucket, \"example-bucket\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.channels.stop.snippet.json b/storage.channels.stop.snippet.json new file mode 100644 index 0000000..c7d0103 --- /dev/null +++ b/storage.channels.stop.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.channels.stop\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tChannel channel = new Channel();\r\n\t\t// Add your code to populate the channel object\r\n\t\tStorage.Channels.Stop call = storageService.channels().stop(channel);\r\n\t\t response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.channels.stop\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nchannel = {} # construct your object here\r\nrequest = service.channels().stop(body=channel)\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.channels.stop\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var channel = new Channel();\r\n // Add your code to populate the channel object\r\n var call = storageService.Channels.Stop(channel);\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.defaultObjectAccessControls.delete.snippet.json b/storage.defaultObjectAccessControls.delete.snippet.json new file mode 100644 index 0000000..427cb5b --- /dev/null +++ b/storage.defaultObjectAccessControls.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.defaultObjectAccessControls.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tStorage.DefaultObjectAccessControls.Delete request = storageService.defaultObjectAccessControls().delete(\"example-bucket\", \"example-entity\");\r\n\t\t response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.defaultObjectAccessControls.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nservice.defaultObjectAccessControls().delete(bucket=\"example-bucket\", entity=\"example-entity\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.defaultObjectAccessControls.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storageService.DefaultObjectAccessControls.Delete(\"example-bucket\", \"example-entity\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.defaultObjectAccessControls.get.snippet.json b/storage.defaultObjectAccessControls.get.snippet.json new file mode 100644 index 0000000..575e0a9 --- /dev/null +++ b/storage.defaultObjectAccessControls.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.defaultObjectAccessControls.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tStorage.DefaultObjectAccessControls.Get request = storageService.defaultObjectAccessControls().get(\"example-bucket\", \"example-entity\");\r\n\t\tObjectAccessControl response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.defaultObjectAccessControls.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nservice.defaultObjectAccessControls().get(bucket=\"example-bucket\", entity=\"example-entity\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.defaultObjectAccessControls.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storageService.DefaultObjectAccessControls.Get(\"example-bucket\", \"example-entity\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.defaultObjectAccessControls.insert.snippet.json b/storage.defaultObjectAccessControls.insert.snippet.json new file mode 100644 index 0000000..c41e678 --- /dev/null +++ b/storage.defaultObjectAccessControls.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.defaultObjectAccessControls.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tObjectAccessControl objectAccessControl = new ObjectAccessControl();\r\n\t\t// Add your code to populate the objectAccessControl object\r\n\t\tStorage.DefaultObjectAccessControls.Insert call = storageService.defaultObjectAccessControls().insert(\"example-bucket\", objectAccessControl);\r\n\t\tObjectAccessControl response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.defaultObjectAccessControls.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nobject_access_control = {} # construct your object here\r\nrequest = service.defaultObjectAccessControls().insert(body=object_access_control, bucket=\"example-bucket\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.defaultObjectAccessControls.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var objectAccessControl = new ObjectAccessControl();\r\n // Add your code to populate the objectAccessControl object\r\n var call = storageService.DefaultObjectAccessControls.Insert(objectAccessControl, \"example-bucket\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.defaultObjectAccessControls.list.snippet.json b/storage.defaultObjectAccessControls.list.snippet.json new file mode 100644 index 0000000..a84ae44 --- /dev/null +++ b/storage.defaultObjectAccessControls.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.defaultObjectAccessControls.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tStorage.DefaultObjectAccessControls.List request = storageService.defaultObjectAccessControls().list(\"example-bucket\");\r\n\t\tObjectAccessControls response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.defaultObjectAccessControls.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nservice.defaultObjectAccessControls().list(bucket=\"example-bucket\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.defaultObjectAccessControls.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storageService.DefaultObjectAccessControls.List(\"example-bucket\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.defaultObjectAccessControls.patch.snippet.json b/storage.defaultObjectAccessControls.patch.snippet.json new file mode 100644 index 0000000..0d2e58d --- /dev/null +++ b/storage.defaultObjectAccessControls.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.defaultObjectAccessControls.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\t// Obtain the ObjectAccessControl object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tStorage.DefaultObjectAccessControls.Patch request = storageService.defaultObjectAccessControls().patch(\"example-bucket\", \"example-entity\", objectAccessControl);\r\n\t\tObjectAccessControl response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.defaultObjectAccessControls.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\n# Obtain the object_access_control object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.defaultObjectAccessControls().patch(body=object_access_control, bucket=\"example-bucket\", entity=\"example-entity\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.defaultObjectAccessControls.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the ObjectAccessControl object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = storageService.DefaultObjectAccessControls.Patch(objectAccessControl, \"example-bucket\", \"example-entity\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.defaultObjectAccessControls.update.snippet.json b/storage.defaultObjectAccessControls.update.snippet.json new file mode 100644 index 0000000..194dcf0 --- /dev/null +++ b/storage.defaultObjectAccessControls.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.defaultObjectAccessControls.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tObjectAccessControl objectAccessControl = new ObjectAccessControl();\r\n\t\t// Add your code to populate the objectAccessControl object\r\n\t\tStorage.DefaultObjectAccessControls.Update call = storageService.defaultObjectAccessControls().update(\"example-bucket\", \"example-entity\", objectAccessControl);\r\n\t\tObjectAccessControl response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.defaultObjectAccessControls.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nobject_access_control = {} # construct your object here\r\nrequest = service.defaultObjectAccessControls().update(body=object_access_control, bucket=\"example-bucket\", entity=\"example-entity\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.defaultObjectAccessControls.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var objectAccessControl = new ObjectAccessControl();\r\n // Add your code to populate the objectAccessControl object\r\n var call = storageService.DefaultObjectAccessControls.Update(objectAccessControl, \"example-bucket\", \"example-entity\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.objectAccessControls.delete.snippet.json b/storage.objectAccessControls.delete.snippet.json new file mode 100644 index 0000000..e6c7966 --- /dev/null +++ b/storage.objectAccessControls.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.objectAccessControls.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tStorage.ObjectAccessControls.Delete request = storageService.objectAccessControls().delete(\"example-bucket\", \"example-object\", \"example-entity\");\r\n\t\t response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.objectAccessControls.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nservice.objectAccessControls().delete(bucket=\"example-bucket\", object=\"example-object\", entity=\"example-entity\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.objectAccessControls.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storageService.ObjectAccessControls.Delete(\"example-bucket\", \"example-object\", \"example-entity\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.objectAccessControls.get.snippet.json b/storage.objectAccessControls.get.snippet.json new file mode 100644 index 0000000..99f77e6 --- /dev/null +++ b/storage.objectAccessControls.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.objectAccessControls.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tStorage.ObjectAccessControls.Get request = storageService.objectAccessControls().get(\"example-bucket\", \"example-object\", \"example-entity\");\r\n\t\tObjectAccessControl response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.objectAccessControls.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nservice.objectAccessControls().get(bucket=\"example-bucket\", object=\"example-object\", entity=\"example-entity\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.objectAccessControls.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storageService.ObjectAccessControls.Get(\"example-bucket\", \"example-object\", \"example-entity\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.objectAccessControls.insert.snippet.json b/storage.objectAccessControls.insert.snippet.json new file mode 100644 index 0000000..6bafadc --- /dev/null +++ b/storage.objectAccessControls.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.objectAccessControls.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tObjectAccessControl objectAccessControl = new ObjectAccessControl();\r\n\t\t// Add your code to populate the objectAccessControl object\r\n\t\tStorage.ObjectAccessControls.Insert call = storageService.objectAccessControls().insert(\"example-bucket\", \"example-object\", objectAccessControl);\r\n\t\tObjectAccessControl response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.objectAccessControls.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nobject_access_control = {} # construct your object here\r\nrequest = service.objectAccessControls().insert(body=object_access_control, bucket=\"example-bucket\", object=\"example-object\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.objectAccessControls.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var objectAccessControl = new ObjectAccessControl();\r\n // Add your code to populate the objectAccessControl object\r\n var call = storageService.ObjectAccessControls.Insert(objectAccessControl, \"example-bucket\", \"example-object\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.objectAccessControls.list.snippet.json b/storage.objectAccessControls.list.snippet.json new file mode 100644 index 0000000..d8c6d48 --- /dev/null +++ b/storage.objectAccessControls.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.objectAccessControls.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tStorage.ObjectAccessControls.List request = storageService.objectAccessControls().list(\"example-bucket\", \"example-object\");\r\n\t\tObjectAccessControls response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.objectAccessControls.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nservice.objectAccessControls().list(bucket=\"example-bucket\", object=\"example-object\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.objectAccessControls.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storageService.ObjectAccessControls.List(\"example-bucket\", \"example-object\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.objectAccessControls.patch.snippet.json b/storage.objectAccessControls.patch.snippet.json new file mode 100644 index 0000000..7475413 --- /dev/null +++ b/storage.objectAccessControls.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.objectAccessControls.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\t// Obtain the ObjectAccessControl object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tStorage.ObjectAccessControls.Patch request = storageService.objectAccessControls().patch(\"example-bucket\", \"example-object\", \"example-entity\", objectAccessControl);\r\n\t\tObjectAccessControl response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.objectAccessControls.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\n# Obtain the object_access_control object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.objectAccessControls().patch(body=object_access_control, bucket=\"example-bucket\", object=\"example-object\", entity=\"example-entity\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.objectAccessControls.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the ObjectAccessControl object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = storageService.ObjectAccessControls.Patch(objectAccessControl, \"example-bucket\", \"example-object\", \"example-entity\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.objectAccessControls.update.snippet.json b/storage.objectAccessControls.update.snippet.json new file mode 100644 index 0000000..6952f41 --- /dev/null +++ b/storage.objectAccessControls.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.objectAccessControls.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tObjectAccessControl objectAccessControl = new ObjectAccessControl();\r\n\t\t// Add your code to populate the objectAccessControl object\r\n\t\tStorage.ObjectAccessControls.Update call = storageService.objectAccessControls().update(\"example-bucket\", \"example-object\", \"example-entity\", objectAccessControl);\r\n\t\tObjectAccessControl response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.objectAccessControls.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nobject_access_control = {} # construct your object here\r\nrequest = service.objectAccessControls().update(body=object_access_control, bucket=\"example-bucket\", object=\"example-object\", entity=\"example-entity\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.objectAccessControls.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var objectAccessControl = new ObjectAccessControl();\r\n // Add your code to populate the objectAccessControl object\r\n var call = storageService.ObjectAccessControls.Update(objectAccessControl, \"example-bucket\", \"example-object\", \"example-entity\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.objects.compose.snippet.json b/storage.objects.compose.snippet.json new file mode 100644 index 0000000..f4eab3b --- /dev/null +++ b/storage.objects.compose.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.objects.compose\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tComposeRequest composeRequest = new ComposeRequest();\r\n\t\t// Add your code to populate the composeRequest object\r\n\t\tStorage.Objects.Compose call = storageService.objects().compose(\"example-destinationBucket\", \"example-destinationObject\", composeRequest);\r\n\t\tObject response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.objects.compose\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\ncompose_request = {} # construct your object here\r\nrequest = service.objects().compose(body=compose_request, destinationBucket=\"example-destinationBucket\", destinationObject=\"example-destinationObject\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.objects.compose\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var composeRequest = new ComposeRequest();\r\n // Add your code to populate the composeRequest object\r\n var call = storageService.Objects.Compose(composeRequest, \"example-destinationBucket\", \"example-destinationObject\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.objects.copy.snippet.json b/storage.objects.copy.snippet.json new file mode 100644 index 0000000..b257c40 --- /dev/null +++ b/storage.objects.copy.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.objects.copy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tObject object__ = new Object();\r\n\t\t// Add your code to populate the object__ object\r\n\t\tStorage.Objects.Copy call = storageService.objects().copy(\"example-sourceBucket\", \"example-sourceObject\", \"example-destinationBucket\", \"example-destinationObject\", object__);\r\n\t\tObject response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.objects.copy\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nobject = {} # construct your object here\r\nrequest = service.objects().copy(body=object, sourceBucket=\"example-sourceBucket\", sourceObject=\"example-sourceObject\", destinationBucket=\"example-destinationBucket\", destinationObject=\"example-destinationObject\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.objects.copy\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var object__ = new Object();\r\n // Add your code to populate the object__ object\r\n var call = storageService.Objects.Copy(object__, \"example-sourceBucket\", \"example-sourceObject\", \"example-destinationBucket\", \"example-destinationObject\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.objects.delete.snippet.json b/storage.objects.delete.snippet.json new file mode 100644 index 0000000..4720b55 --- /dev/null +++ b/storage.objects.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.objects.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tStorage.Objects.Delete request = storageService.objects().delete(\"example-bucket\", \"example-object\");\r\n\t\t response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.objects.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nservice.objects().delete(bucket=\"example-bucket\", object=\"example-object\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.objects.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storageService.Objects.Delete(\"example-bucket\", \"example-object\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.objects.get.snippet.json b/storage.objects.get.snippet.json new file mode 100644 index 0000000..4e2798e --- /dev/null +++ b/storage.objects.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.objects.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tStorage.Objects.Get request = storageService.objects().get(\"example-bucket\", \"example-object\");\r\n\t\tObject response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.objects.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nservice.objects().get(bucket=\"example-bucket\", object=\"example-object\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.objects.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storageService.Objects.Get(\"example-bucket\", \"example-object\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.objects.insert.snippet.json b/storage.objects.insert.snippet.json new file mode 100644 index 0000000..c78a723 --- /dev/null +++ b/storage.objects.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.objects.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tObject object__ = new Object();\r\n\t\t// Add your code to populate the object__ object\r\n\t\tStorage.Objects.Insert call = storageService.objects().insert(\"example-bucket\", object__);\r\n\t\tObject response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.objects.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nobject = {} # construct your object here\r\nrequest = service.objects().insert(body=object, bucket=\"example-bucket\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.objects.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var object__ = new Object();\r\n // Add your code to populate the object__ object\r\n var call = storageService.Objects.Insert(object__, \"example-bucket\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.objects.list.snippet.json b/storage.objects.list.snippet.json new file mode 100644 index 0000000..1327859 --- /dev/null +++ b/storage.objects.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.objects.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tObjects response;\r\n\t\tStorage.Objects.List request = storageService.objects().list(\"example-bucket\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getItems() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Object item : response.getItems()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for storage.objects.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nrequest = service.objects().list(bucket=\"example-bucket\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.objects().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.objects.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n Objects response;\r\n var request = storageService.Objects.List(\"example-bucket\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Items == null)\r\n continue;\r\n\r\n foreach (var item in response.Items)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.objects.patch.snippet.json b/storage.objects.patch.snippet.json new file mode 100644 index 0000000..a61fd3e --- /dev/null +++ b/storage.objects.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.objects.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\t// Obtain the Object object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tStorage.Objects.Patch request = storageService.objects().patch(\"example-bucket\", \"example-object\", object__);\r\n\t\tObject response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.objects.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\n# Obtain the object object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.objects().patch(body=object, bucket=\"example-bucket\", object=\"example-object\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.objects.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the Object object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = storageService.Objects.Patch(object__, \"example-bucket\", \"example-object\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.objects.rewrite.snippet.json b/storage.objects.rewrite.snippet.json new file mode 100644 index 0000000..d31c7fc --- /dev/null +++ b/storage.objects.rewrite.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.objects.rewrite\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tObject object__ = new Object();\r\n\t\t// Add your code to populate the object__ object\r\n\t\tStorage.Objects.Rewrite call = storageService.objects().rewrite(\"example-sourceBucket\", \"example-sourceObject\", \"example-destinationBucket\", \"example-destinationObject\", object__);\r\n\t\tRewriteResponse response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.objects.rewrite\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nobject = {} # construct your object here\r\nrequest = service.objects().rewrite(body=object, sourceBucket=\"example-sourceBucket\", sourceObject=\"example-sourceObject\", destinationBucket=\"example-destinationBucket\", destinationObject=\"example-destinationObject\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.objects.rewrite\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var object__ = new Object();\r\n // Add your code to populate the object__ object\r\n var call = storageService.Objects.Rewrite(object__, \"example-sourceBucket\", \"example-sourceObject\", \"example-destinationBucket\", \"example-destinationObject\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.objects.update.snippet.json b/storage.objects.update.snippet.json new file mode 100644 index 0000000..fdc75c7 --- /dev/null +++ b/storage.objects.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.objects.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tObject object__ = new Object();\r\n\t\t// Add your code to populate the object__ object\r\n\t\tStorage.Objects.Update call = storageService.objects().update(\"example-bucket\", \"example-object\", object__);\r\n\t\tObject response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.objects.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nobject = {} # construct your object here\r\nrequest = service.objects().update(body=object, bucket=\"example-bucket\", object=\"example-object\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.objects.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var object__ = new Object();\r\n // Add your code to populate the object__ object\r\n var call = storageService.Objects.Update(object__, \"example-bucket\", \"example-object\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storage.objects.watchAll.snippet.json b/storage.objects.watchAll.snippet.json new file mode 100644 index 0000000..9e502c5 --- /dev/null +++ b/storage.objects.watchAll.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storage","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storage.objects.watchAll\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/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/storage/v1/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.storage.Storage;\r\nimport com.google.api.services.storage.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StorageSample {\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\tStorage storageService = new Storage.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\tChannel channel = new Channel();\r\n\t\t// Add your code to populate the channel object\r\n\t\tStorage.Objects.WatchAll call = storageService.objects().watchAll(\"example-bucket\", channel);\r\n\t\tChannel response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storage.objects.watchAll\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storage Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storage_component/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 'storage' service, at version 'v1'.\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('storage', 'v1', credentials=credentials)\r\n\r\nchannel = {} # construct your object here\r\nrequest = service.objects().watchAll(body=channel, bucket=\"example-bucket\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storage.objects.watchAll\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storage Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storage_component/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storage.v1\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.Storage.v1;\r\nusing Google.Apis.Storage.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StorageSample\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 storageService = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var channel = new Channel();\r\n // Add your code to populate the channel object\r\n var call = storageService.Objects.WatchAll(channel, \"example-bucket\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storagetransfer.getGoogleServiceAccount.snippet.json b/storagetransfer.getGoogleServiceAccount.snippet.json new file mode 100644 index 0000000..e1dac4e --- /dev/null +++ b/storagetransfer.getGoogleServiceAccount.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storagetransfer","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storagetransfer.getGoogleServiceAccount\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/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/storagetransfer/v1/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.storagetransfer.Storagetransfer;\r\nimport com.google.api.services.storagetransfer.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StoragetransferSample {\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\tStoragetransfer storagetransferService = new Storagetransfer.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\tStoragetransfer.V1.GetGoogleServiceAccount request = storagetransferService.v1().getGoogleServiceAccount();\r\n\t\tGoogleServiceAccount response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storagetransfer.getGoogleServiceAccount\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storagetransfer/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 'storagetransfer' service, at version 'v1'.\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('storagetransfer', 'v1', credentials=credentials)\r\n\r\nservice.v1().getGoogleServiceAccount().execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storagetransfer.getGoogleServiceAccount\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storagetransfer.v1\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.Storagetransfer.v1;\r\nusing Google.Apis.Storagetransfer.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StoragetransferSample\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 storagetransferService = new StoragetransferService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storagetransferService.V1.GetGoogleServiceAccount();\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storagetransfer.googleServiceAccounts.get.snippet.json b/storagetransfer.googleServiceAccounts.get.snippet.json new file mode 100644 index 0000000..0d47367 --- /dev/null +++ b/storagetransfer.googleServiceAccounts.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storagetransfer","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storagetransfer.googleServiceAccounts.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/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/storagetransfer/v1/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.storagetransfer.Storagetransfer;\r\nimport com.google.api.services.storagetransfer.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StoragetransferSample {\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\tStoragetransfer storagetransferService = new Storagetransfer.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\tStoragetransfer.GoogleServiceAccounts.Get request = storagetransferService.googleServiceAccounts().get(\"example-project\");\r\n\t\tGoogleServiceAccount response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storagetransfer.googleServiceAccounts.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storagetransfer/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 'storagetransfer' service, at version 'v1'.\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('storagetransfer', 'v1', credentials=credentials)\r\n\r\nservice.googleServiceAccounts().get(projectId=\"example-project\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storagetransfer.googleServiceAccounts.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storagetransfer.v1\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.Storagetransfer.v1;\r\nusing Google.Apis.Storagetransfer.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StoragetransferSample\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 storagetransferService = new StoragetransferService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storagetransferService.GoogleServiceAccounts.Get(\"example-project\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storagetransfer.transferJobs.create.snippet.json b/storagetransfer.transferJobs.create.snippet.json new file mode 100644 index 0000000..40bc08c --- /dev/null +++ b/storagetransfer.transferJobs.create.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storagetransfer","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storagetransfer.transferJobs.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/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/storagetransfer/v1/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.storagetransfer.Storagetransfer;\r\nimport com.google.api.services.storagetransfer.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StoragetransferSample {\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\tStoragetransfer storagetransferService = new Storagetransfer.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\tTransferJob transferJob = new TransferJob();\r\n\t\t// Add your code to populate the transferJob object\r\n\t\tStoragetransfer.TransferJobs.Create call = storagetransferService.transferJobs().create(transferJob);\r\n\t\tTransferJob response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storagetransfer.transferJobs.create\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storagetransfer/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 'storagetransfer' service, at version 'v1'.\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('storagetransfer', 'v1', credentials=credentials)\r\n\r\ntransfer_job = {} # construct your object here\r\nrequest = service.transferJobs().create(body=transfer_job)\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storagetransfer.transferJobs.create\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storagetransfer.v1\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.Storagetransfer.v1;\r\nusing Google.Apis.Storagetransfer.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StoragetransferSample\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 storagetransferService = new StoragetransferService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var transferJob = new TransferJob();\r\n // Add your code to populate the transferJob object\r\n var call = storagetransferService.TransferJobs.Create(transferJob);\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storagetransfer.transferJobs.get.snippet.json b/storagetransfer.transferJobs.get.snippet.json new file mode 100644 index 0000000..f0758d2 --- /dev/null +++ b/storagetransfer.transferJobs.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storagetransfer","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storagetransfer.transferJobs.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/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/storagetransfer/v1/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.storagetransfer.Storagetransfer;\r\nimport com.google.api.services.storagetransfer.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StoragetransferSample {\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\tStoragetransfer storagetransferService = new Storagetransfer.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\tStoragetransfer.TransferJobs.Get request = storagetransferService.transferJobs().get(\"example-jobName\");\r\n\t\tTransferJob response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storagetransfer.transferJobs.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storagetransfer/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 'storagetransfer' service, at version 'v1'.\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('storagetransfer', 'v1', credentials=credentials)\r\n\r\nservice.transferJobs().get(jobName=\"example-jobName\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storagetransfer.transferJobs.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storagetransfer.v1\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.Storagetransfer.v1;\r\nusing Google.Apis.Storagetransfer.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StoragetransferSample\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 storagetransferService = new StoragetransferService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storagetransferService.TransferJobs.Get(\"example-jobName\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storagetransfer.transferJobs.list.snippet.json b/storagetransfer.transferJobs.list.snippet.json new file mode 100644 index 0000000..b8598ac --- /dev/null +++ b/storagetransfer.transferJobs.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storagetransfer","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storagetransfer.transferJobs.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/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/storagetransfer/v1/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.storagetransfer.Storagetransfer;\r\nimport com.google.api.services.storagetransfer.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StoragetransferSample {\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\tStoragetransfer storagetransferService = new Storagetransfer.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\tListTransferJobsResponse response;\r\n\t\tStoragetransfer.TransferJobs.List request = storagetransferService.transferJobs().list();\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getTransferJobs() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (TransferJob item : response.getTransferJobs()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for storagetransfer.transferJobs.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storagetransfer/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 'storagetransfer' service, at version 'v1'.\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('storagetransfer', 'v1', credentials=credentials)\r\n\r\nrequest = service.transferJobs().list()\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.transferJobs().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storagetransfer.transferJobs.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storagetransfer.v1\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.Storagetransfer.v1;\r\nusing Google.Apis.Storagetransfer.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StoragetransferSample\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 storagetransferService = new StoragetransferService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListTransferJobsResponse response;\r\n var request = storagetransferService.TransferJobs.List();\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.TransferJobs == null)\r\n continue;\r\n\r\n foreach (var item in response.TransferJobs)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storagetransfer.transferJobs.patch.snippet.json b/storagetransfer.transferJobs.patch.snippet.json new file mode 100644 index 0000000..3fa9b5b --- /dev/null +++ b/storagetransfer.transferJobs.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storagetransfer","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storagetransfer.transferJobs.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/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/storagetransfer/v1/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.storagetransfer.Storagetransfer;\r\nimport com.google.api.services.storagetransfer.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StoragetransferSample {\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\tStoragetransfer storagetransferService = new Storagetransfer.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\t// Obtain the UpdateTransferJobRequest object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tStoragetransfer.TransferJobs.Patch request = storagetransferService.transferJobs().patch(\"example-jobName\", updateTransferJobRequest);\r\n\t\tTransferJob response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storagetransfer.transferJobs.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storagetransfer/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 'storagetransfer' service, at version 'v1'.\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('storagetransfer', 'v1', credentials=credentials)\r\n\r\n# Obtain the update_transfer_job_request object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.transferJobs().patch(body=update_transfer_job_request, jobName=\"example-jobName\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storagetransfer.transferJobs.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storagetransfer.v1\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.Storagetransfer.v1;\r\nusing Google.Apis.Storagetransfer.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StoragetransferSample\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 storagetransferService = new StoragetransferService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the UpdateTransferJobRequest object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = storagetransferService.TransferJobs.Patch(updateTransferJobRequest, \"example-jobName\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storagetransfer.transferOperations.cancel.snippet.json b/storagetransfer.transferOperations.cancel.snippet.json new file mode 100644 index 0000000..38780c9 --- /dev/null +++ b/storagetransfer.transferOperations.cancel.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storagetransfer","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storagetransfer.transferOperations.cancel\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/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/storagetransfer/v1/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.storagetransfer.Storagetransfer;\r\nimport com.google.api.services.storagetransfer.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StoragetransferSample {\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\tStoragetransfer storagetransferService = new Storagetransfer.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\tStoragetransfer.TransferOperations.Cancel request = storagetransferService.transferOperations().cancel(\"example-name\");\r\n\t\tEmpty response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storagetransfer.transferOperations.cancel\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storagetransfer/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 'storagetransfer' service, at version 'v1'.\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('storagetransfer', 'v1', credentials=credentials)\r\n\r\nservice.transferOperations().cancel(name=\"example-name\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storagetransfer.transferOperations.cancel\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storagetransfer.v1\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.Storagetransfer.v1;\r\nusing Google.Apis.Storagetransfer.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StoragetransferSample\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 storagetransferService = new StoragetransferService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storagetransferService.TransferOperations.Cancel(\"example-name\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storagetransfer.transferOperations.delete.snippet.json b/storagetransfer.transferOperations.delete.snippet.json new file mode 100644 index 0000000..42ff7d7 --- /dev/null +++ b/storagetransfer.transferOperations.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storagetransfer","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storagetransfer.transferOperations.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/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/storagetransfer/v1/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.storagetransfer.Storagetransfer;\r\nimport com.google.api.services.storagetransfer.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StoragetransferSample {\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\tStoragetransfer storagetransferService = new Storagetransfer.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\tStoragetransfer.TransferOperations.Delete request = storagetransferService.transferOperations().delete(\"example-name\");\r\n\t\tEmpty response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storagetransfer.transferOperations.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storagetransfer/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 'storagetransfer' service, at version 'v1'.\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('storagetransfer', 'v1', credentials=credentials)\r\n\r\nservice.transferOperations().delete(name=\"example-name\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storagetransfer.transferOperations.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storagetransfer.v1\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.Storagetransfer.v1;\r\nusing Google.Apis.Storagetransfer.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StoragetransferSample\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 storagetransferService = new StoragetransferService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storagetransferService.TransferOperations.Delete(\"example-name\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storagetransfer.transferOperations.get.snippet.json b/storagetransfer.transferOperations.get.snippet.json new file mode 100644 index 0000000..a6efdf9 --- /dev/null +++ b/storagetransfer.transferOperations.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storagetransfer","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storagetransfer.transferOperations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/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/storagetransfer/v1/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.storagetransfer.Storagetransfer;\r\nimport com.google.api.services.storagetransfer.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StoragetransferSample {\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\tStoragetransfer storagetransferService = new Storagetransfer.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\tStoragetransfer.TransferOperations.Get request = storagetransferService.transferOperations().get(\"example-name\");\r\n\t\tOperation response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storagetransfer.transferOperations.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storagetransfer/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 'storagetransfer' service, at version 'v1'.\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('storagetransfer', 'v1', credentials=credentials)\r\n\r\nservice.transferOperations().get(name=\"example-name\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storagetransfer.transferOperations.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storagetransfer.v1\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.Storagetransfer.v1;\r\nusing Google.Apis.Storagetransfer.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StoragetransferSample\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 storagetransferService = new StoragetransferService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = storagetransferService.TransferOperations.Get(\"example-name\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storagetransfer.transferOperations.list.snippet.json b/storagetransfer.transferOperations.list.snippet.json new file mode 100644 index 0000000..23c1301 --- /dev/null +++ b/storagetransfer.transferOperations.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storagetransfer","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storagetransfer.transferOperations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/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/storagetransfer/v1/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.storagetransfer.Storagetransfer;\r\nimport com.google.api.services.storagetransfer.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StoragetransferSample {\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\tStoragetransfer storagetransferService = new Storagetransfer.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\tListOperationsResponse response;\r\n\t\tStoragetransfer.TransferOperations.List request = storagetransferService.transferOperations().list(\"example-name\");\r\n\t\tdo {\r\n\t\t\tresponse = request.execute();\r\n\t\t\tif(response.getOperations() == null)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tfor (Operation item : response.getOperations()){\r\n\t\t\t\t// Add your code to process the item object\r\n\t\t\t}\r\n\r\n\t\t\trequest.setPageToken(response.getNextPageToken());\r\n\t\t} while (null != response.getNextPageToken());\r\n\t}\r\n}","python":"# Autogenerated example code for storagetransfer.transferOperations.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storagetransfer/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 'storagetransfer' service, at version 'v1'.\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('storagetransfer', 'v1', credentials=credentials)\r\n\r\nrequest = service.transferOperations().list(name=\"example-name\")\r\nwhile request:\r\n response = request.execute()\r\n # Add code to process instance\r\n print(json.dumps(response, indent=2))\r\n request = service.transferOperations().list_next(request, response)","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storagetransfer.transferOperations.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storagetransfer.v1\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.Storagetransfer.v1;\r\nusing Google.Apis.Storagetransfer.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StoragetransferSample\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 storagetransferService = new StoragetransferService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n ListOperationsResponse response;\r\n var request = storagetransferService.TransferOperations.List(\"example-name\");\r\n do\r\n {\r\n response = request.Execute();\r\n if (response.Operations == null)\r\n continue;\r\n\r\n foreach (var item in response.Operations)\r\n {\r\n // Add your code to process the item object\r\n }\r\n\r\n request.PageToken = response.NextPageToken;\r\n } while (response.NextPageToken != null);\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storagetransfer.transferOperations.pause.snippet.json b/storagetransfer.transferOperations.pause.snippet.json new file mode 100644 index 0000000..25d3f0a --- /dev/null +++ b/storagetransfer.transferOperations.pause.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storagetransfer","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storagetransfer.transferOperations.pause\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/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/storagetransfer/v1/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.storagetransfer.Storagetransfer;\r\nimport com.google.api.services.storagetransfer.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StoragetransferSample {\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\tStoragetransfer storagetransferService = new Storagetransfer.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\tPauseTransferOperationRequest pauseTransferOperationRequest = new PauseTransferOperationRequest();\r\n\t\t// Add your code to populate the pauseTransferOperationRequest object\r\n\t\tStoragetransfer.TransferOperations.Pause call = storagetransferService.transferOperations().pause(\"example-name\", pauseTransferOperationRequest);\r\n\t\tEmpty response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storagetransfer.transferOperations.pause\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storagetransfer/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 'storagetransfer' service, at version 'v1'.\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('storagetransfer', 'v1', credentials=credentials)\r\n\r\npause_transfer_operation_request = {} # construct your object here\r\nrequest = service.transferOperations().pause(body=pause_transfer_operation_request, name=\"example-name\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storagetransfer.transferOperations.pause\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storagetransfer.v1\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.Storagetransfer.v1;\r\nusing Google.Apis.Storagetransfer.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StoragetransferSample\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 storagetransferService = new StoragetransferService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var pauseTransferOperationRequest = new PauseTransferOperationRequest();\r\n // Add your code to populate the pauseTransferOperationRequest object\r\n var call = storagetransferService.TransferOperations.Pause(pauseTransferOperationRequest, \"example-name\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/storagetransfer.transferOperations.resume.snippet.json b/storagetransfer.transferOperations.resume.snippet.json new file mode 100644 index 0000000..cedb5a5 --- /dev/null +++ b/storagetransfer.transferOperations.resume.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"storagetransfer","apiVersion":"v1","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for storagetransfer.transferOperations.resume\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/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/storagetransfer/v1/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.storagetransfer.Storagetransfer;\r\nimport com.google.api.services.storagetransfer.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class StoragetransferSample {\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\tStoragetransfer storagetransferService = new Storagetransfer.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\tResumeTransferOperationRequest resumeTransferOperationRequest = new ResumeTransferOperationRequest();\r\n\t\t// Add your code to populate the resumeTransferOperationRequest object\r\n\t\tStoragetransfer.TransferOperations.Resume call = storagetransferService.transferOperations().resume(\"example-name\", resumeTransferOperationRequest);\r\n\t\tEmpty response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for storagetransfer.transferOperations.resume\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/storagetransfer/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 'storagetransfer' service, at version 'v1'.\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('storagetransfer', 'v1', credentials=credentials)\r\n\r\nresume_transfer_operation_request = {} # construct your object here\r\nrequest = service.transferOperations().resume(body=resume_transfer_operation_request, name=\"example-name\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for storagetransfer.transferOperations.resume\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable storagetransfer Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/storagetransfer/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.storagetransfer.v1\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.Storagetransfer.v1;\r\nusing Google.Apis.Storagetransfer.v1.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass StoragetransferSample\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 storagetransferService = new StoragetransferService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var resumeTransferOperationRequest = new ResumeTransferOperationRequest();\r\n // Add your code to populate the resumeTransferOperationRequest object\r\n var call = storagetransferService.TransferOperations.Resume(resumeTransferOperationRequest, \"example-name\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/taskqueue.taskqueues.get.snippet.json b/taskqueue.taskqueues.get.snippet.json new file mode 100644 index 0000000..d074525 --- /dev/null +++ b/taskqueue.taskqueues.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"taskqueue","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for taskqueue.taskqueues.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable taskqueue Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/taskqueue/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/taskqueue/v1beta2/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.taskqueue.Taskqueue;\r\nimport com.google.api.services.taskqueue.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class TaskqueueSample {\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\tTaskqueue taskqueueService = new Taskqueue.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\tTaskqueue.Taskqueues.Get request = taskqueueService.taskqueues().get(\"example-project\", \"example-taskqueue\");\r\n\t\tTaskQueue response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for taskqueue.taskqueues.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable taskqueue Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/taskqueue/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 'taskqueue' service, at version 'v1beta2'.\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('taskqueue', 'v1beta2', credentials=credentials)\r\n\r\nservice.taskqueues().get(project=\"example-project\", taskqueue=\"example-taskqueue\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for taskqueue.taskqueues.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable taskqueue Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/taskqueue/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.taskqueue.v1beta2\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.Taskqueue.v1beta2;\r\nusing Google.Apis.Taskqueue.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass TaskqueueSample\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 taskqueueService = new TaskqueueService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = taskqueueService.Taskqueues.Get(\"example-project\", \"example-taskqueue\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/taskqueue.tasks.delete.snippet.json b/taskqueue.tasks.delete.snippet.json new file mode 100644 index 0000000..0b6d0d3 --- /dev/null +++ b/taskqueue.tasks.delete.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"taskqueue","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for taskqueue.tasks.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable taskqueue Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/taskqueue/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/taskqueue/v1beta2/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.taskqueue.Taskqueue;\r\nimport com.google.api.services.taskqueue.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class TaskqueueSample {\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\tTaskqueue taskqueueService = new Taskqueue.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\tTaskqueue.Tasks.Delete request = taskqueueService.tasks().delete(\"example-project\", \"example-taskqueue\", \"example-task\");\r\n\t\t response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for taskqueue.tasks.delete\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable taskqueue Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/taskqueue/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 'taskqueue' service, at version 'v1beta2'.\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('taskqueue', 'v1beta2', credentials=credentials)\r\n\r\nservice.tasks().delete(project=\"example-project\", taskqueue=\"example-taskqueue\", task=\"example-task\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for taskqueue.tasks.delete\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable taskqueue Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/taskqueue/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.taskqueue.v1beta2\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.Taskqueue.v1beta2;\r\nusing Google.Apis.Taskqueue.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass TaskqueueSample\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 taskqueueService = new TaskqueueService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = taskqueueService.Tasks.Delete(\"example-project\", \"example-taskqueue\", \"example-task\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/taskqueue.tasks.get.snippet.json b/taskqueue.tasks.get.snippet.json new file mode 100644 index 0000000..9e02144 --- /dev/null +++ b/taskqueue.tasks.get.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"taskqueue","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for taskqueue.tasks.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable taskqueue Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/taskqueue/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/taskqueue/v1beta2/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.taskqueue.Taskqueue;\r\nimport com.google.api.services.taskqueue.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class TaskqueueSample {\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\tTaskqueue taskqueueService = new Taskqueue.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\tTaskqueue.Tasks.Get request = taskqueueService.tasks().get(\"example-project\", \"example-taskqueue\", \"example-task\");\r\n\t\tTask response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for taskqueue.tasks.get\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable taskqueue Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/taskqueue/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 'taskqueue' service, at version 'v1beta2'.\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('taskqueue', 'v1beta2', credentials=credentials)\r\n\r\nservice.tasks().get(project=\"example-project\", taskqueue=\"example-taskqueue\", task=\"example-task\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for taskqueue.tasks.get\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable taskqueue Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/taskqueue/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.taskqueue.v1beta2\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.Taskqueue.v1beta2;\r\nusing Google.Apis.Taskqueue.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass TaskqueueSample\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 taskqueueService = new TaskqueueService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = taskqueueService.Tasks.Get(\"example-project\", \"example-taskqueue\", \"example-task\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/taskqueue.tasks.insert.snippet.json b/taskqueue.tasks.insert.snippet.json new file mode 100644 index 0000000..14fe859 --- /dev/null +++ b/taskqueue.tasks.insert.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"taskqueue","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for taskqueue.tasks.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable taskqueue Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/taskqueue/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/taskqueue/v1beta2/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.taskqueue.Taskqueue;\r\nimport com.google.api.services.taskqueue.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class TaskqueueSample {\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\tTaskqueue taskqueueService = new Taskqueue.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\tTask task = new Task();\r\n\t\t// Add your code to populate the task object\r\n\t\tTaskqueue.Tasks.Insert call = taskqueueService.tasks().insert(\"example-project\", \"example-taskqueue\", task);\r\n\t\tTask response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for taskqueue.tasks.insert\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable taskqueue Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/taskqueue/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 'taskqueue' service, at version 'v1beta2'.\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('taskqueue', 'v1beta2', credentials=credentials)\r\n\r\ntask = {} # construct your object here\r\nrequest = service.tasks().insert(body=task, project=\"example-project\", taskqueue=\"example-taskqueue\")\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for taskqueue.tasks.insert\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable taskqueue Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/taskqueue/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.taskqueue.v1beta2\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.Taskqueue.v1beta2;\r\nusing Google.Apis.Taskqueue.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass TaskqueueSample\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 taskqueueService = new TaskqueueService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var task = new Task();\r\n // Add your code to populate the task object\r\n var call = taskqueueService.Tasks.Insert(task, \"example-project\", \"example-taskqueue\");\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/taskqueue.tasks.lease.snippet.json b/taskqueue.tasks.lease.snippet.json new file mode 100644 index 0000000..52f49ae --- /dev/null +++ b/taskqueue.tasks.lease.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"taskqueue","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for taskqueue.tasks.lease\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable taskqueue Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/taskqueue/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/taskqueue/v1beta2/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.taskqueue.Taskqueue;\r\nimport com.google.api.services.taskqueue.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class TaskqueueSample {\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\tTaskqueue taskqueueService = new Taskqueue.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\tTaskqueue.Tasks.Lease request = taskqueueService.tasks().lease(\"example-project\", \"example-taskqueue\", numTasks_of_type_integer, leaseSecs_of_type_integer);\r\n\t\tTasks response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for taskqueue.tasks.lease\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable taskqueue Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/taskqueue/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 'taskqueue' service, at version 'v1beta2'.\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('taskqueue', 'v1beta2', credentials=credentials)\r\n\r\nservice.tasks().lease(project=\"example-project\", taskqueue=\"example-taskqueue\", numTasks=numTasks_of_type_integer, leaseSecs=leaseSecs_of_type_integer).execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for taskqueue.tasks.lease\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable taskqueue Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/taskqueue/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.taskqueue.v1beta2\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.Taskqueue.v1beta2;\r\nusing Google.Apis.Taskqueue.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass TaskqueueSample\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 taskqueueService = new TaskqueueService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = taskqueueService.Tasks.Lease(\"example-project\", \"example-taskqueue\", numTasks_of_type_integer, leaseSecs_of_type_integer);\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/taskqueue.tasks.list.snippet.json b/taskqueue.tasks.list.snippet.json new file mode 100644 index 0000000..ffd3be4 --- /dev/null +++ b/taskqueue.tasks.list.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"taskqueue","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for taskqueue.tasks.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable taskqueue Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/taskqueue/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/taskqueue/v1beta2/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.taskqueue.Taskqueue;\r\nimport com.google.api.services.taskqueue.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class TaskqueueSample {\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\tTaskqueue taskqueueService = new Taskqueue.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\tTaskqueue.Tasks.List request = taskqueueService.tasks().list(\"example-project\", \"example-taskqueue\");\r\n\t\tTasks2 response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for taskqueue.tasks.list\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable taskqueue Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/taskqueue/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 'taskqueue' service, at version 'v1beta2'.\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('taskqueue', 'v1beta2', credentials=credentials)\r\n\r\nservice.tasks().list(project=\"example-project\", taskqueue=\"example-taskqueue\").execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for taskqueue.tasks.list\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable taskqueue Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/taskqueue/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.taskqueue.v1beta2\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.Taskqueue.v1beta2;\r\nusing Google.Apis.Taskqueue.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass TaskqueueSample\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 taskqueueService = new TaskqueueService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var request = taskqueueService.Tasks.List(\"example-project\", \"example-taskqueue\");\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/taskqueue.tasks.patch.snippet.json b/taskqueue.tasks.patch.snippet.json new file mode 100644 index 0000000..1130de2 --- /dev/null +++ b/taskqueue.tasks.patch.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"taskqueue","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for taskqueue.tasks.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable taskqueue Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/taskqueue/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/taskqueue/v1beta2/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.taskqueue.Taskqueue;\r\nimport com.google.api.services.taskqueue.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class TaskqueueSample {\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\tTaskqueue taskqueueService = new Taskqueue.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\t// Obtain the Task object obtained from a previous method, modify \r\n\t\t// it with the updates and pass it as a parameter to the Patch method\r\n\t\tTaskqueue.Tasks.Patch request = taskqueueService.tasks().patch(\"example-project\", \"example-taskqueue\", \"example-task\", newLeaseSeconds_of_type_integer, task);\r\n\t\tTask response = request.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for taskqueue.tasks.patch\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable taskqueue Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/taskqueue/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 'taskqueue' service, at version 'v1beta2'.\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('taskqueue', 'v1beta2', credentials=credentials)\r\n\r\n# Obtain the task object obtained from a previous method, modify \r\n# it with the updates and pass it as a parameter to the patch method\r\nrequest = service.tasks().patch(body=task, project=\"example-project\", taskqueue=\"example-taskqueue\", task=\"example-task\", newLeaseSeconds=newLeaseSeconds_of_type_integer)\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for taskqueue.tasks.patch\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable taskqueue Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/taskqueue/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.taskqueue.v1beta2\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.Taskqueue.v1beta2;\r\nusing Google.Apis.Taskqueue.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass TaskqueueSample\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 taskqueueService = new TaskqueueService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n // Obtain the Task object obtained from a previous method, modify \r\n // it with the updates and pass it as a parameter to the Patch method\r\n var request = taskqueueService.Tasks.Patch(task, \"example-project\", \"example-taskqueue\", \"example-task\", newLeaseSeconds_of_type_integer);\r\n var response = request.Execute();\r\n }\r\n}","ruby":null,"php":null}} diff --git a/taskqueue.tasks.update.snippet.json b/taskqueue.tasks.update.snippet.json new file mode 100644 index 0000000..23ddaea --- /dev/null +++ b/taskqueue.tasks.update.snippet.json @@ -0,0 +1 @@ +{"metadata":{"apiName":"taskqueue","apiVersion":"v1beta2","fragmentGenerationVersion":"0.1","generatedOn":"1-21-2016"},"code_fragment":{"java":"// Autogenerated example code for taskqueue.tasks.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable taskqueue Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/taskqueue/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/taskqueue/v1beta2/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.taskqueue.Taskqueue;\r\nimport com.google.api.services.taskqueue.model.*;\r\n\r\nimport java.io.IOException;\r\nimport java.security.GeneralSecurityException;\r\nimport java.util.Collections;\r\n\r\npublic class TaskqueueSample {\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\tTaskqueue taskqueueService = new Taskqueue.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\tTask task = new Task();\r\n\t\t// Add your code to populate the task object\r\n\t\tTaskqueue.Tasks.Update call = taskqueueService.tasks().update(\"example-project\", \"example-taskqueue\", \"example-task\", newLeaseSeconds_of_type_integer, task);\r\n\t\tTask response = call.execute();\r\n\t}\r\n}","python":"# Autogenerated example code for taskqueue.tasks.update\r\n\r\n# PRE-REQUISITES:\r\n# ---------------\r\n# 1. If not already done, enable taskqueue Api and check quota for your project at\r\n# https://console.developers.google.com/apis/api/taskqueue/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 'taskqueue' service, at version 'v1beta2'.\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('taskqueue', 'v1beta2', credentials=credentials)\r\n\r\ntask = {} # construct your object here\r\nrequest = service.tasks().update(body=task, project=\"example-project\", taskqueue=\"example-taskqueue\", task=\"example-task\", newLeaseSeconds=newLeaseSeconds_of_type_integer)\r\nrequest.execute()","go":null,"nodejs":null,"csharp":"// Autogenerated example code for taskqueue.tasks.update\r\n\r\n// PRE-REQUISITES:\r\n// ---------------\r\n// 1. If not already done, enable taskqueue Api and check quota for your project at\r\n// https://console.developers.google.com/apis/api/taskqueue/quotas \r\n// 2. Use the nuget package manager to install the package Google.Apis.taskqueue.v1beta2\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.Taskqueue.v1beta2;\r\nusing Google.Apis.Taskqueue.v1beta2.Data;\r\nusing Google.Apis.Auth.OAuth2;\r\nusing Google.Apis.Services;\r\nusing System;\r\n\r\nclass TaskqueueSample\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 taskqueueService = new TaskqueueService(new BaseClientService.Initializer() { HttpClientInitializer = credential });\r\n\r\n var task = new Task();\r\n // Add your code to populate the task object\r\n var call = taskqueueService.Tasks.Update(task, \"example-project\", \"example-taskqueue\", \"example-task\", newLeaseSeconds_of_type_integer);\r\n var response = call.Execute();\r\n }\r\n}","ruby":null,"php":null}}