I have managed to undeploy a model from an endpoint using UndeployModelRequest
:
model_name = f'projects/{project}/locations/{location}/models/{model_id}'
model_request = aiplatform_v1.types.GetModelRequest(name=model_name)
model_info = client_model.get_model(request=model_request)
deployed_models_info = model_info.deployed_models
deployed_model_id=model_info.deployed_models[0].deployed_model_id
undeploy_request = aiplatform_v1.types.UndeployModelRequest
(endpoint=end_point, deployed_model_id=deployed_model_id)
client.undeploy_model(request=undeploy_request)
but all this depends on knowing model_id
. I want to be able to just undeploy a model from an endpoint without knowing the model's id (there will only be one model per endpoint ever). Is that possible or can I get the model id from the endpoint somehow?