Please find the error update_volume_response = core_client.update_instance(instance_id=i.id, update_instance_details = oci.core.models.UpdateInstanceDetails(freeform_tags)) TypeError: UpdateInstanceDetails.init() takes 1 positional argument but 2 were given
core_client = oci.core.compute_client.ComputeClient(config)
core_client.base_client.set_region('us-phoenix-1')
vol=oci.core.BlockstorageClient(config)
# Send the request to service, there are more available parameters to send in the request
lista = core_client.list_instances(compartment_id=compartment_id,lifecycle_state="STOPPED")
for i in lista.data:
inst=core_client.get_instance(instance_id=i.id)
#print(inst.data)
update_volume_response = core_client.update_instance(update_instance_details = oci.core.models.UpdateInstanceDetails(freefrom_tag={"shutdown": "no"}))
print(update_volume_response)
break
The update instance API requires instanceId as a required parameter that seems to be missing in your code. You can then provide freeform_tags (not freefrom_tag) as an optional attribute.
API reference - https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/Instance/UpdateInstance
Here is the sample that worked for me:
core_client = oci.core.compute_client.ComputeClient(config)
core_client.base_client.set_region('us-phoenix-1')
# Send the request to service, there are more available parameters to send in the request
lista = core_client.list_instances(compartment_id=compartment_id,lifecycle_state="STOPPED")
for i in lista.data:
update_instance_response = core_client.update_instance(
instance_id=i.id,
update_instance_details=oci.core.models.UpdateInstanceDetails(
freeform_tags={
'shutdown': 'no'})
)
break
Hope it helps.