Protected tags API: deploy keys cannot be set for Free tier

Problem

Reported here: #402238 (comment 2518813222)

Users can choose Deploy Keys to configure Protected Tags and Protected Branches via UI.

Screenshot_2025-05-23_at_10.05.29

However, an attempt to set the deploy key via API doesn't set the key.

Click to expand
% curl \
   --request POST \
   --header "PRIVATE-TOKEN: [MASKED]" \
   --header "Content-Type: application/json" \
   --url "https://[MASKED].com/api/v4/projects/3354/protected_tags" \
   --data '{
      "name" : "scm/*",
      "create_access_level" : 40,
      "allowed_to_create" : [
         { "access_level" : 40 },
         { "deploy_key_id" : 1801 }
      ]
   }'
{
   "name": "scm/*",
   "create_access_levels": [
      {
         "id": 718,
         "access_level": 40,
         "access_level_description": "Maintainers",
         "deploy_key_id": null
      }
   ]
}

Proposal

API doesn't support deploy_key setting because this configuration is limited to EE version only.

We should explore an option to allow configuring deploy_key via API for Free tier as well.

We should do this for protected tags and protected branches.

These should be done in separate MRs to keep the change-sets reviewable.

Decision making and research

There was a duplicate issue with some helpful research over at #574256 (comment 2801984735). It was decided that since the existing state allows the deploy key to be set from the UI in the protected tags and branches settings, we should update the API to allow this in the free tier as well.

Edited by Hunter Stewart