Sha256: 85519b48ca1abaaf16e939c30d997f03c781eb9143d8e903644ab7d2550a3a7a

Contents?: true

Size: 1.88 KB

Versions: 1

Compression:

Stored size: 1.88 KB

Contents

require "schema_registry_cli/version"
require 'wrappi'

module SchemaRegistryCli
  # Ruby client for confluent schema registry
  # https://github.com/confluentinc/schema-registry
  #
  class Client < Wrappi::Client
    setup do |config|
      config.domain = 'http://localhost:8081/'
      config.headers = {
        'Content-Type' => 'application/vnd.schemaregistry.v1+json'
      }
    end
  end
  
  def self.setup
    Client
  end

  class Endpoint < Wrappi::Endpoint
    client Client
  end

  def self.register(subject, schema)
    Register.call!(schema: schema.to_json, subject: subject).body
  end

  def self.subjects
    Subjects.call!.body
  end

  def self.subject_versions(subject)
    SubjectVersions.call!(subject: subject).body
  end

  def self.fetch_schema(id)
    FetchSchema.call!(id: id).body
  end
  def self.fetch(id)
    fetch_schema(id)
  end

  def self.fetch_version(subject, version = "latest")
    FetchVersion.call!(subject: subject, version: version).body
  end
  def self.subject_version(*args)
    fetch_version(*args)
  end

  def self.latest_version(subject)
    LatestVersion.call!(subject: subject).body
  end

  def self.delete_version(subject, version)
    DeleteVersion.call!(subject: subject, version: version).body
  end

  def self.delete_subject(subject)
    DeleteSubject.call!(subject: subject).body
  end

  def self.check_registered(subject, body)
    CheckRegistered.call!(schema: body.to_json, subject: subject).body
  end

  def self.test_compatibility(subject, schema)
    TestCompatibility.call!(subject: subject, schema: schema.to_json).body
  end

  def self.sr_config
    SRConfig.call!.body
  end

  def self.update_config(value)
    UpdateConfig.call!(compatibility: value).body
  end

  def self.update_subject_compatibility(value)
    UpdateSubjectCompatibility.call!(subject: subject, compatibility: value).body
  end
end

require 'schema_registry_cli/endpoints'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
schema_registry_cli-0.2.0 lib/schema_registry_cli.rb