feat: allow for provider immutability

being able to update providers means that admins should have the ability to turn this feature off. introduce `immutable` as a field in the Provider class. Defauling to false means all providers can be updated by default, but an admin at runtime can choose to set this to True to disable provider updating

Signed-off-by: Charlie Doern <cdoern@redhat.com>
This commit is contained in:
Charlie Doern 2025-06-30 15:07:09 -04:00
parent 436f8ade9e
commit e4b040d5cc
35 changed files with 554 additions and 0 deletions

View file

@ -151,6 +151,7 @@ class Provider(BaseModel):
provider_id: str | None
provider_type: str
config: dict[str, Any]
immutable: bool = False
class LoggingConfig(BaseModel):

View file

@ -147,7 +147,10 @@ class ProviderImpl(Providers):
if prov_api != api:
continue
for p in providers:
# the provider needs to be mutable for us to update its config
if p.provider_id == provider_id:
if p.immutable:
raise ValueError(f"Provider {provider_id} is immutable, you can only update mutable providers.")
existing_provider = p
break
if existing_provider is not None: