Merge branch '8784-dir-listings'
[arvados.git] / sdk / cli / bin / arv-tag
index e400dab7dabdc656d6e552ed762194d0bc0b20fb..b1783bccf3f277cd705b5012b382182cb3e6b3ad 100755 (executable)
@@ -1,4 +1,7 @@
 #! /usr/bin/env ruby
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
 
 # arv tag usage:
 #   arv tag add tag1 [tag2 ...] --object obj_uuid1 [--object obj_uuid2 ...]
@@ -17,11 +20,13 @@ def usage
 end
 
 def api_call(method, parameters:{}, request_body:{})
-  request_body[:api_token] = ENV['ARVADOS_API_TOKEN']
   result = $client.execute(:api_method => method,
                            :parameters => parameters,
                            :body_object => request_body,
-                           :authenticated => false)
+                           :authenticated => false,
+                           :headers => {
+                             authorization: "OAuth2 #{ENV['ARVADOS_API_TOKEN']}",
+                           })
 
   begin
     results = JSON.parse result.body
@@ -99,7 +104,8 @@ $arvados_api_host = ENV['ARVADOS_API_HOST'] or
   abort "#{$0}: fatal: ARVADOS_API_HOST environment variable not set."
 $arvados_api_token = ENV['ARVADOS_API_TOKEN'] or
   abort "#{$0}: fatal: ARVADOS_API_TOKEN environment variable not set."
-$arvados_api_host_insecure = ENV['ARVADOS_API_HOST_INSECURE'] == 'yes'
+$arvados_api_host_insecure = %w(1 true yes).
+  include?((ENV['ARVADOS_API_HOST_INSECURE'] || "").downcase)
 
 begin
   require 'rubygems'