smart_city_registry v5.0.2 SmartCity.Registry.Organization View Source
Struct defining an organization definition and functions for reading and writing organization definitions to Redis.
const Organization = {
"id": "", // uuid
"orgTitle": "", // user friendly
"orgName": "", // system friendly
"description": "",
"logoUrl": "",
"homepage": "",
"dn": "" // LDAP distinguished name
}
Link to this section Summary
Functions
Returns {:ok, organization}
with the organization for the given id, or an error with the reason.
Returns the organization with the given id or raises an error.
Returns {:ok, organization}
with all organization definitions in the system.
See get_all/0
. Raises on errors.
Returns {:ok, organization_versions}
with a history of all versions of the given organization.
See get_history/1
. Raises on errors.
Returns a new SmartCity.Registry.Organization
struct.
Writes the organization to history and sets the organization as the latest definition for the given id
field of the passed in organization in Redis.
Link to this section Types
Link to this section Functions
get(id)
View Sourceget(id()) :: {:ok, SmartCity.Registry.Organization.t()} | {:error, term()}
Returns {:ok, organization}
with the organization for the given id, or an error with the reason.
get!(id)
View Sourceget!(id()) :: SmartCity.Registry.Organization.t() | no_return()
Returns the organization with the given id or raises an error.
get_all()
View Sourceget_all() :: {:ok, [SmartCity.Registry.Organization.t()]} | {:error, term()}
Returns {:ok, organization}
with all organization definitions in the system.
get_all!()
View Sourceget_all!() :: [SmartCity.Registry.Organization.t()] | no_return()
See get_all/0
. Raises on errors.
get_history(id)
View Sourceget_history(id()) :: {:ok, [SmartCity.Registry.Organization.t()]} | {:error, term()}
Returns {:ok, organization_versions}
with a history of all versions of the given organization.
get_history!(id)
View Sourceget_history!(id()) :: [SmartCity.Registry.Organization.t()] | no_return()
See get_history/1
. Raises on errors.
new(msg)
View Sourcenew(String.t() | map()) :: {:ok, SmartCity.Organization.t()} | {:error, term()}
Returns a new SmartCity.Registry.Organization
struct.
Can be created from:
- map with string keys
- map with atom keys
- JSON
write(organization)
View Sourcewrite(SmartCity.Organization.t()) :: {:ok, id()} | {:error, reason()}
Writes the organization to history and sets the organization as the latest definition for the given id
field of the passed in organization in Redis.
Registry subscribers will be notified and have their handle_organization/1
callback triggered.
Returns an {:ok, id} tuple() where id is the organization id.
Parameters
- organization: SmartCity.Registry.Organization struct to be written.