Example #1
0
 def _create_context(self, data, force_domain_creation,
                     update_if_already_exists, publish):
     entity = Context.create_new(data.organization, data.domain, data.name,
                                 data.version, data.content)
     return self._create_schema_or_context("context", self._client.contexts,
                                           entity, data,
                                           force_domain_creation,
                                           update_if_already_exists,
                                           publish)
Example #2
0
 def create_context(self, name: str, version: str, data: JSON, publish: bool) -> Context:
     key = self._entity_name(name, version)
     context = self.client.contexts.read(self.organization, self.domain, name, version)
     if context is not None:
         self._print_already_created(key)
         return context
     else:
         local = Context.create_new(self.organization, self.domain, name, version, data)
         context = self.client.contexts.create(local)
         self.client.contexts.publish(context, publish=publish)
         self._print_created(key)
         return context
Example #3
0
 def create_context(self, name: str, version: str, data: JSON,
                    publish: bool) -> Context:
     key = self._entity_name(name, version)
     context = self.client.contexts.read(self.organization, self.domain,
                                         name, version)
     if context is not None:
         self._print_already_created(key)
         return context
     else:
         local = Context.create_new(self.organization, self.domain, name,
                                    version, data)
         context = self.client.contexts.create(local)
         self.client.contexts.publish(context, publish=publish)
         self._print_created(key)
         return context