defmodule Edgehog.Containers.ImageCredentials do @moduledoc false use Edgehog.MultitenantResource, domain: Edgehog.Containers, extensions: [ AshGraphql.Resource ] alias Edgehog.Containers.ImageCredentials.Base64JsonEncoding resource do description """ Contains the credentials used to pull an image from a device. Credentials are uniquely identified trough their `:id`, a unique `name` field is also provided. The module stores `username` and `password` """ end graphql do type :image_credentials end actions do defaults [:destroy, :read] create :create do primary? true accept [:label, :username, :password] end end attributes do uuid_primary_key :id attribute :label, :string do allow_nil? false public? true end attribute :username, :string do allow_nil? false public? true end attribute :password, :string do sensitive? true allow_nil? false end create_timestamp :inserted_at update_timestamp :updated_at end relationships do has_many :images, Edgehog.Containers.Image end calculations do calculate :base64_json, :string, Base64JsonEncoding end identities do identity :label, [:label] end postgres do table "image_credentials" repo Edgehog.Repo end end