@@ -0,0 +1,1705 @@
+# -*- coding: utf-8 -*-%0A#%0A# Copyright 2019 Google LLC%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A#     https://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS,%0A# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A# See the License for the specific language governing permissions and%0A# limitations under the License.%0A%0Aimport sys%0A%0A# %5BSTART automl_cancel_operation%5D%0A%0Afrom google.cloud import automl_v1beta1%0A%0A%0Adef sample_cancel_operation(project, operation_id):%0A    %22%22%22%0A    Cancel Long-Running Operation%0A%0A    Args:%0A      project Required. Your Google Cloud Project ID.%0A      operation_id Required. The ID of the Operation.%0A    %22%22%22%0A%0A    client = automl_v1beta1.AutoMlClient()%0A%0A    operations_client = client.transport._operations_client%0A%0A    # project = '%5BGoogle Cloud Project ID%5D'%0A    # operation_id = '%5BOperation ID%5D'%0A    name = %22projects/%7B%7D/locations/us-central1/operations/%7B%7D%22.format(%0A        project, operation_id%0A    )%0A%0A    operations_client.cancel_operation(name)%0A%0A    print(u%22Cancelled operation: %7B%7D%22.format(name))%0A%0A%0A# %5BEND automl_cancel_operation%5D%0A%0A%0Adef main():%0A    import argparse%0A%0A    parser = argparse.ArgumentParser()%0A    parser.add_argument(%22--project%22, type=str, default=%22%5BGoogle Cloud Project ID%5D%22)%0A    parser.add_argument(%22--operation_id%22, type=str, default=%22%5BOperation ID%5D%22)%0A    args = parser.parse_args()%0A%0A    sample_cancel_operation(args.project, args.operation_id)%0A%0A%0Aif __name__ == %22__main__%22:%0A    main()

add cancel operation sample