Reputation: 1544
Any suggestion to manage App Engine labels
using gcloud
command or atleast from the GCP console
. I am trying to add a label
for an already deployed application
Cannot see any option to update App Engine Service
label parameters with gcloud
command
$ gcloud app instances
ERROR: (gcloud.app.instances) Command name argument expected.
Available commands for gcloud app instances:
delete Delete a specified instance.
describe Display all data about an existing instance.
disable-debug Disable debug mode for an instance.
enable-debug Enable debug mode for an instance (only works on
the flexible environment).
list List the instances affiliated with the current App
Engine project.
scp SCP from or to the VM of an App Engine Flexible
instance.
ssh SSH into the VM of an App Engine Flexible
instance.
Also any option to manage from terraform
? .
Cannot find any attributes
to manage labels
anything under
https://www.terraform.io/docs/providers/google/r/app_engine_standard_app_version.html
https://www.terraform.io/docs/providers/google/r/app_engine_application.html
Upvotes: 4
Views: 2230
Reputation: 53
A little late to the party but we needed to do something similar but using the C# AppEngine client library (Google.Apis.Appengine.v1). This works for us using the latest version of the library, assuming you've already retrieved the AppEngine service object, and you know your target projectId and service name:
var labels = new Dictionary<string,string>(); //Set your labels in here
service.Labels = labels;
var patchRequest = appEngineService.Apps.Services.Patch(service, project,
serviceId);
patchRequest.UpdateMask = "Labels";
return await patchRequest.ExecuteAsync();
Upvotes: 2
Reputation: 489
Labels are now part of the API, but it does not look like it is documented. Using PATCH through the REST API can set labels on services for App Engine.
https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services/patch
The Service type does not include labels
, but if you run gcloud app services describe SERVICE --format=json
, you will see that labels is included in the response.
Example setting label using curl:
curl \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-X PATCH \
-d '{"labels":{"label_name":"label_value"}}' \
"https://appengine.googleapis.com/v1/apps/${project}/services/${service}?updateMask=labels"
Upvotes: 3
Reputation: 2002
Although I couldn't find a way to do it through the gcloud CLI you can set labels to App Engine resources through the Console UI with the following steps:
This process is documented here.
Moreover, feel free to file a feature requests in Google's Issue Tracker asking for the addition of a labeling option in the gcloud CLI.
Upvotes: 7