source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/parameters_schema.rb
Ruby
apache-2.0
203
main
1,157
module VCAP::Services::ServiceBrokers::V2 class ParametersSchema include CatalogValidationHelper attr_reader :errors, :parameters def initialize(parent, path) @errors = VCAP::Services::ValidationErrors.new @parameters_data = parent['parameters'] @path = path + ['parameters'] bui...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/catalog_service.rb
Ruby
apache-2.0
203
main
6,565
module VCAP::Services::ServiceBrokers::V2 class CatalogService include CatalogValidationHelper SUPPORTED_REQUIRES_VALUES = %w[syslog_drain route_forwarding volume_mount].freeze attr_reader :service_broker, :broker_provided_id, :metadata, :name, :description, :bindable, :tags, :plans, :re...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/schema.rb
Ruby
apache-2.0
203
main
2,573
require 'json-schema' require 'active_model' module VCAP module Services module ServiceBrokers module V2 class Schema include ActiveModel::Validations attr_reader :schema MAX_SCHEMA_SIZE = 65_536 validates_length_of :to_json, maximum: MAX_SCHEMA_SIZE, mess...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/service_instance_schema.rb
Ruby
apache-2.0
203
main
1,316
module VCAP::Services::ServiceBrokers::V2 class ServiceInstanceSchema include CatalogValidationHelper attr_reader :errors, :create, :update def initialize(instance) @errors = VCAP::Services::ValidationErrors.new @instance = instance @create_data = instance['create'] @update_data ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/catalog_validation_helper.rb
Ruby
apache-2.0
203
main
3,259
require 'vcap/semver_validator' module VCAP::Services::ServiceBrokers::V2 module CatalogValidationHelper def validate_description!(name, input, opts={}) validate_string!(name, input, opts) return unless input.respond_to?(:length) && input.length > 10_000 errors.add("#{human_readable_attr_name...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/client.rb
Ruby
apache-2.0
203
main
17,616
require 'presenters/mixins/metadata_presentation_helpers' module VCAP::Services::ServiceBrokers::V2 class Client include VCAP::CloudController::Presenters::Mixins::MetadataPresentationHelpers CATALOG_PATH = '/v2/catalog'.freeze PLATFORM = 'cloudfoundry'.freeze attr_reader :orphan_mitigator def...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/catalog.rb
Ruby
apache-2.0
203
main
5,704
module VCAP::Services::ServiceBrokers::V2 class Catalog attr_reader :service_broker, :services, :plans, :errors, :incompatibility_errors alias_method :validation_errors, :errors def initialize(service_broker, catalog_hash) @service_broker = service_broker @services = [] @plans = [] ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/response_parser.rb
Ruby
apache-2.0
203
main
31,771
module VCAP::Services module ServiceBrokers module V2 class ResponseParser def initialize(url, log_errors: nil, log_validators: nil, log_response_fields: nil) @url = url @logger = Steno.logger('cc.service_broker.v2.client') @log_errors = log_errors || false @l...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/http_client.rb
Ruby
apache-2.0
203
main
4,670
require 'httpclient' module VCAP::Services module ServiceBrokers::V2 module IdentityEncoder def self.encode(user_guid) "cloudfoundry #{Base64.strict_encode64({ user_id: user_guid }.to_json)}" end end class HttpClient attr_reader :url def initialize(attrs, logger=nil) ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/catalog_schemas.rb
Ruby
apache-2.0
203
main
1,741
module VCAP::Services::ServiceBrokers::V2 class CatalogSchemas include CatalogValidationHelper attr_reader :errors, :service_instance, :service_binding def initialize(schemas) @errors = VCAP::Services::ValidationErrors.new @schemas = schemas @service_instance_data = schemas['service_i...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/http_response.rb
Ruby
apache-2.0
203
main
2,723
module VCAP::Services::ServiceBrokers::V2 class HttpResponse attr_reader :code, :message, :body STATUS_CODE_MESSAGES = { 100 => 'Continue', 101 => 'Switching Protocols', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/errors.rb
Ruby
apache-2.0
203
main
1,016
require 'services/service_brokers/v2/errors/service_broker_api_unreachable' require 'services/service_brokers/v2/errors/service_broker_api_timeout' require 'services/service_brokers/v2/errors/http_client_timeout' require 'services/service_brokers/v2/errors/service_broker_response_malformed' require 'services/service_br...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/catalog_plan.rb
Ruby
apache-2.0
203
main
3,627
module VCAP::Services::ServiceBrokers::V2 class CatalogPlan include CatalogValidationHelper ALLOWED_MAINTENANCE_INFO_KEYS = %w[version description].freeze attr_reader :broker_provided_id, :name, :description, :metadata, :maximum_polling_duration, :maintenance_info, :catalog_service, :err...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/errors/service_broker_invalid_volume_mounts.rb
Ruby
apache-2.0
203
main
619
module VCAP::Services module ServiceBrokers module V2 module Errors class ServiceBrokerInvalidVolumeMounts < HttpResponseError def initialize(_uri, method, response, description) super( description_from_response(description), method, re...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/errors/service_broker_invalid_syslog_drain_url.rb
Ruby
apache-2.0
203
main
551
module VCAP::Services module ServiceBrokers module V2 module Errors class ServiceBrokerInvalidSyslogDrainUrl < HttpResponseError def initialize(_uri, method, response) super( 'The service is attempting to stream logs from your application, but is not registered as...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/errors/service_broker_api_authentication_failed.rb
Ruby
apache-2.0
203
main
512
module VCAP::Services module ServiceBrokers module V2 module Errors class ServiceBrokerApiAuthenticationFailed < HttpResponseError def initialize(_uri, method, response) super( 'Authentication with the service broker failed. Double-check that the username and pass...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/errors/service_broker_api_unreachable.rb
Ruby
apache-2.0
203
main
472
require 'net/http' module VCAP::Services module ServiceBrokers module V2 module Errors class ServiceBrokerApiUnreachable < HttpRequestError def initialize(uri, method, source) super( 'The service broker could not be reached', uri, meth...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/errors/maintenance_info_conflict.rb
Ruby
apache-2.0
203
main
1,060
module VCAP::Services module ServiceBrokers module V2 module Errors class MaintenanceInfoConflict < HttpResponseError def initialize(_uri, method, response) begin body = Oj.load(response.body) rescue StandardError # ignore end...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/errors/concurrency_error.rb
Ruby
apache-2.0
203
main
452
module VCAP::Services module ServiceBrokers module V2 module Errors class ConcurrencyError < HttpResponseError def initialize(_uri, method, response) message = CloudController::Errors::ApiError.new_from_details('ServiceBrokerConcurrencyError').message super(message,...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/errors/http_client_timeout.rb
Ruby
apache-2.0
203
main
466
require 'net/http' module VCAP::Services module ServiceBrokers module V2 module Errors class HttpClientTimeout < HttpRequestError def initialize(uri, method, source) super( 'The request to the service broker timed out', uri, method, ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/errors/service_broker_bad_response.rb
Ruby
apache-2.0
203
main
1,174
require 'cloud_controller/http_response_error' module VCAP::Services module ServiceBrokers module V2 module Errors class ServiceBrokerBadResponse < HttpResponseError def initialize(_uri, method, response, ignore_description_key: false) begin hash = Oj.load(respon...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/errors/app_required.rb
Ruby
apache-2.0
203
main
442
module VCAP::Services module ServiceBrokers module V2 module Errors class AppRequired < HttpResponseError def initialize(_uri, method, response) message = 'This service supports generation of credentials through binding an application only.' super(message, method, r...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/errors/service_broker_conflict.rb
Ruby
apache-2.0
203
main
1,128
module VCAP::Services module ServiceBrokers module V2 module Errors class ServiceBrokerConflict < HttpResponseError def initialize(_uri, method, response) error_message = nil parsed_response = parsed_json(response.body) if parsed_response.is_a?(Hash) && ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/errors/service_broker_request_rejected.rb
Ruby
apache-2.0
203
main
821
module VCAP::Services module ServiceBrokers module V2 module Errors class ServiceBrokerRequestRejected < HttpResponseError def initialize(_uri, method, response) begin hash = Oj.load(response.body) rescue StandardError # ignore ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/errors/async_required.rb
Ruby
apache-2.0
203
main
446
module VCAP::Services module ServiceBrokers module V2 module Errors class AsyncRequired < HttpResponseError def initialize(_uri, method, response) message = CloudController::Errors::ApiError.new_from_details('ServiceBrokerAsyncRequired').message super(message, metho...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/errors/service_broker_response_malformed.rb
Ruby
apache-2.0
203
main
617
module VCAP::Services module ServiceBrokers module V2 module Errors class ServiceBrokerResponseMalformed < HttpResponseError def initialize(_uri, method, response, description) super( description_from_response(description), method, resp...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/v2/errors/service_broker_api_timeout.rb
Ruby
apache-2.0
203
main
472
require 'net/http' module VCAP::Services module ServiceBrokers module V2 module Errors class ServiceBrokerApiTimeout < HttpRequestError def initialize(uri, method, source) super( 'The request to the service broker timed out', uri, meth...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/services/service_brokers/user_provided/client.rb
Ruby
apache-2.0
203
main
990
module VCAP::Services module ServiceBrokers module UserProvided class Client def provision(_); end def bind(binding, arbitrary_parameters: nil, accepts_incomplete: nil, user_guid: nil) if binding.class.name.demodulize == 'RouteBinding' { async: false, ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/sequel/plugins/microsecond_timestamp_precision.rb
Ruby
apache-2.0
203
main
213
module Sequel module Plugins module MicrosecondTimestampPrecision module DatasetMethods def default_timestamp_format "'%Y-%m-%d %H:%M:%S.%6N'" end end end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/sequel/extensions/query_length_logging.rb
Ruby
apache-2.0
203
main
341
# frozen_string_literal: true module Sequel::QueryLengthLogging # Include SQL query length when logging query. def log_connection_yield(sql, conn, args=nil) sql = "(query_length=#{sql.length}) #{sql}" unless @loggers.empty? super end end Sequel::Database.register_extension(:query_length_logging, Sequel:...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/sequel/extensions/request_query_metrics.rb
Ruby
apache-2.0
203
main
306
# frozen_string_literal: true Sequel::Database.register_extension(:request_query_metrics) do |db| mod = Module.new do private def log_duration(duration, message) VCAP::Request.record_db_query((duration * 1_000_000).round) super end end db.singleton_class.prepend(mod) end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/sequel/extensions/connection_metrics.rb
Ruby
apache-2.0
203
main
3,670
# frozen_string_literal: true # # The connection_metrics extension enhances a database's # connection pool to store metrics about the use of connections. # Whenever a connection is acquired or released the number of # currently acquired connections is emitted. Same for making new # connections and disconnecting them f...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/sequel/extensions/default_order_by_id.rb
Ruby
apache-2.0
203
main
3,733
# frozen_string_literal: true # Sequel extension that adds default ORDER BY id to model queries. # # Hooks into fetch methods (all, each, first) to add ORDER BY id just before # execution. This ensures ordering is only added to the final query, not to # subqueries or compound query parts. # # Skips default ordering wh...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/sequel/extensions/requires_unique_column_names_in_subquery.rb
Ruby
apache-2.0
203
main
625
module Sequel::UniqueColumnSubquery def requires_unique_column_names_in_subquery_select_list? Sequel::UniqueColumnSubquery.const_set(:UNIQUE_NAMES_IN_SUBQUERY, unique_names_in_subquery?) unless Sequel::UniqueColumnSubquery.const_defined?(:UNIQUE_NAMES_IN_SUBQUERY) Sequel::UniqueColumnSubquery.const_get(:UNIQ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/steno/context.rb
Ruby
apache-2.0
203
main
479
module Steno end module Steno::Context class Base def data raise NotImplementedError end def clear raise NotImplementedError end end class Null < Base def data {} end def clear nil end end class ThreadLocal < Base THREAD_LOCAL_KEY = '__steno_loc...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/steno/steno.rb
Ruby
apache-2.0
203
main
1,236
require 'steno/codec' require 'steno/config' require 'steno/context' require 'steno/errors' require 'steno/log_level' require 'steno/logger_io' require 'steno/logger' require 'steno/record' require 'steno/sink' module Steno class << self attr_reader :config # Initializes the logging system. This must be cal...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/steno/log_level.rb
Ruby
apache-2.0
203
main
426
require 'active_support/core_ext/module/delegation' module Steno end class Steno::LogLevel include Comparable attr_reader :name, :priority # @param [String] name "info", "debug", etc. # @param [Integer] priority "info" > "debug", etc. def initialize(name, priority) @name = name @priority = ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/steno/logger_io.rb
Ruby
apache-2.0
203
main
362
module Steno end class Steno::LoggerIO def initialize(logger, level) @logger = logger @level = level end def write(str) @logger.log(@level, str) end def puts(*args) args.each { |a| write("#{a}\n") } nil end def flush nil end def close nil end def sync true e...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/steno/config.rb
Ruby
apache-2.0
203
main
2,074
require 'yaml' require 'steno/codec' require 'steno/context' require 'steno/logger' require 'steno/sink' module Steno end class Steno::Config class << self # Creates a config given a yaml file of the following form: # # logging: # level: <info, debug, etc> # file: </path/to/l...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/steno/logger.rb
Ruby
apache-2.0
203
main
3,667
require 'steno/errors' require 'steno/log_level' module Steno end class Steno::Logger LEVELS = { off: Steno::LogLevel.new(:off, 0), fatal: Steno::LogLevel.new(:fatal, 1), error: Steno::LogLevel.new(:error, 5), warn: Steno::LogLevel.new(:warn, 10), info: Steno::LogLevel.new(:info, 15), ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/steno/record.rb
Ruby
apache-2.0
203
main
925
require 'digest/md5' module Steno end class Steno::Record attr_reader :timestamp, :message, :log_level, :source, :data, :thread_id, :fiber_id, :process_id, :file, :lineno, :method # @param [String] source Identifies message source. # @param [Symbol] log_level # @param [String] message # @par...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/steno/codec/json.rb
Ruby
apache-2.0
203
main
1,078
require 'oj' require 'time' require 'steno/codec/base' module Steno module Codec end end class Steno::Codec::Json < Steno::Codec::Base def initialize(opts={}) @iso8601_timestamps = opts[:iso8601_timestamps] || false end def encode_record(record) msg = if record.message.valid_encoding? ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/steno/codec/codec_rfc3339.rb
Ruby
apache-2.0
203
main
941
require 'steno/codec/base' require 'oj' module Steno module Codec class JsonRFC3339 < Steno::Codec::Base def encode_record(record) msg = if record.message.valid_encoding? record.message else # Treat the message as an arbitrary sequence of bytes. ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/steno/codec/base.rb
Ruby
apache-2.0
203
main
561
module Steno module Codec end end class Steno::Codec::Base # Encodes the supplied record as a string. # # @param [Hash] record # # @return [String] def encode_record(record) raise NotImplementedError end private # Hex encodes non-printable ascii characters. # # @param [String] data # ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/steno/sink/io.rb
Ruby
apache-2.0
203
main
1,691
require 'steno/sink/base' module Steno module Sink end end class Steno::Sink::IO < Steno::Sink::Base class << self # Returns a new sink configured to append to the file at path. # # @param [String] path # @param [Hash] If the key :autoflush is set to true, encoded records # ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/steno/sink/base.rb
Ruby
apache-2.0
203
main
709
module Steno module Sink end end # Sinks represent the final destination for log records. They abstract storage # mediums (like files) and transport layers (like sockets). class Steno::Sink::Base attr_accessor :codec # @param [Steno::Codec::Base] formatter Transforms log records to their # raw, string-based...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/steno/sink/counter.rb
Ruby
apache-2.0
203
main
797
require 'steno/sink/base' require 'oj' module Steno module Sink end end class Steno::Sink::Counter < Steno::Sink::Base def initialize # Map of String -> numeric count @counts = {} @mutex = Mutex.new end def add_record(record) level = record.log_level.to_s @mutex.synchronize do @c...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/steno/sink/syslog.rb
Ruby
apache-2.0
203
main
1,781
require 'steno/sink/base' require 'singleton' require 'syslog' class Steno::Sink::Syslog < Steno::Sink::Base include Singleton MAX_MESSAGE_SIZE = 1024 * 3 TRUNCATE_POSTFIX = '...'.freeze LOG_LEVEL_MAP = { fatal: Syslog::LOG_CRIT, error: Syslog::LOG_ERR, warn: Syslog::LOG_WARNING, info: Syslo...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/sequel_plugins/update_or_create.rb
Ruby
apache-2.0
203
main
323
module Sequel::Plugins::UpdateOrCreate module ClassMethods # Like +find_or_create+ but also updates the object in the case when it is in the DB def update_or_create(cond, &) obj = first(cond) if obj obj.tap(&).save(changed: true) else create(cond, &) end end end e...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/sequel_plugins/vcap_user_visibility.rb
Ruby
apache-2.0
203
main
1,130
module Sequel::Plugins::VcapUserVisibility module InstanceMethods def user_visible_relationship_dataset(name, user, admin_override=false) associated_model = self.class.association_reflection(name).associated_class relationship_dataset(name).filter(associated_model.user_visibility(user, admin_override)...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/sequel_plugins/sequel_plugins.rb
Ruby
apache-2.0
203
main
692
require 'sequel_plugins/vcap_validations' require 'sequel_plugins/vcap_serialization' require 'sequel_plugins/vcap_normalization' require 'sequel_plugins/vcap_relations' require 'sequel_plugins/vcap_guid' require 'sequel_plugins/update_or_create' require 'sequel_plugins/vcap_user_group' require 'sequel_plugins/vcap_use...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/sequel_plugins/vcap_normalization.rb
Ruby
apache-2.0
203
main
754
module Sequel::Plugins::VcapNormalization module InstanceMethods # Strips attributes of the model if requested. def []=(key, value) value = strip_if_needed(key, value) super end private def strip_if_needed(key, value) strip_attrs = self.class.strip_attrs || {} value = val...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/sequel_plugins/vcap_user_group.rb
Ruby
apache-2.0
203
main
355
module Sequel::Plugins::VcapUserGroup module ClassMethods def define_user_group(name, opts={}) opts = opts.merge( class: 'VCAP::CloudController::User', join_table: "#{table_name}_#{name}", right_key: :user_id ) many_to_many(name, opts) add_association_dependencies ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/sequel_plugins/vcap_serialization.rb
Ruby
apache-2.0
203
main
5,013
module Sequel::Plugins::VcapSerialization # This plugin implements serialization and deserialization of # Sequel::Models to/from hashes and json. module InstanceMethods # Return a hash of the model instance containing only the parameters # specified by export_attributes. # # @option opts [Array<S...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/sequel_plugins/vcap_guid.rb
Ruby
apache-2.0
203
main
375
require 'securerandom' module Sequel::Plugins::VcapGuid module ClassMethods def no_auto_guid self.no_auto_guid_flag = true end attr_accessor :no_auto_guid_flag end module InstanceMethods def before_create self.guid = SecureRandom.uuid if columns.include?(:guid) && guid.nil? && !self...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/sequel_plugins/vcap_relations.rb
Ruby
apache-2.0
203
main
6,639
module Sequel::Plugins::VcapRelations # Depend on the instance_hooks plugin. def self.apply(model) model.plugin(:instance_hooks) end module InstanceMethods def has_one_to_many?(association) association_type(association) == :one_to_many && send(association).any? end def has_one_to_one?(as...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/sequel_plugins/vcap_validations.rb
Ruby
apache-2.0
203
main
384
module Sequel::Plugins::VcapValidations module InstanceMethods # Validates that an attribute is a valid http or https url # # @param [Symbol] The attribute to validate def validates_url(attr, opts={}) return unless send(attr) validates_format(URI::DEFAULT_PARSER.make_regexp(%w[http https]...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/tasks/clock.rake
Ruby
apache-2.0
203
main
659
namespace :clock do desc 'Start a recurring tasks' task start: :environment do puts RUBY_DESCRIPTION require 'cloud_controller/clock/scheduler' require 'cloud_controller/execution_context' VCAP::CloudController::ExecutionContext::CLOCK.set_rake_context VCAP::CloudController::ExecutionContext::...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/tasks/rake_config.rb
Ruby
apache-2.0
203
main
1,598
class RakeConfig class << self def context @context || :api end attr_writer :context def config secrets_hash = {} # TODO: require secrets fetcher? secrets_hash = VCAP::CloudController::SecretsFetcher.fetch_secrets_from_file(secrets_file) unless secrets_file.nil? api_co...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/tasks/docs.rake
Ruby
apache-2.0
203
main
657
namespace :docs do def print_events(events, title=nil) puts("\n##### #{title.capitalize}\n") unless title.nil? group = '' events.sort.each do |event| event_group = event.split('.')[1] if group != event_group && title.nil? group = event_group puts("\n##### #{group.capitalize} li...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/tasks/rubocop.rake
Ruby
apache-2.0
203
main
1,730
begin require 'rubocop/rake_task' desc 'Run RuboCop' RuboCop::RakeTask.new(:rubocop) namespace :rubocop do desc 'Auto-correct changed files' task changed: :environment do require 'rubocop' changelist = `git diff --name-only`.chomp.split("\n") changelist += `git diff --cached --name-o...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/tasks/rotate_database_key.rake
Ruby
apache-2.0
203
main
334
namespace :rotate_cc_database_key do desc 'Rotate database keys' task perform: :environment do require 'cloud_controller/errands/rotate_database_key' RakeConfig.context = :rotate_database_key BoshErrandEnvironment.new(RakeConfig.config).setup_environment VCAP::CloudController::RotateDatabaseKey.perf...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/tasks/blobstore_benchmarks.rake
Ruby
apache-2.0
203
main
359
require 'cloud_controller/benchmark/blobstore' namespace :benchmarks do desc 'Perform blobstore benchmark' task perform_blobstore_benchmark: :environment do RakeConfig.context = :blobstore_benchmarks BoshErrandEnvironment.new(RakeConfig.config).setup_environment do VCAP::CloudController::Benchmark::B...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/tasks/spec.rake
Ruby
apache-2.0
203
main
1,719
desc 'Runs all specs' task spec: 'spec:all' namespace :spec do task all: ['db:pick', 'db:parallel:recreate'] do if ARGV[1] run_specs(ARGV[1]) else run_specs_parallel('spec') # Run isolated specs separately since they might affect other tests run_specs('spec/isolated_specs') end ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/tasks/buildpacks.rake
Ruby
apache-2.0
203
main
333
namespace :buildpacks do desc 'Install/Update buildpacks' task install: :environment do buildpacks = RakeConfig.config.get(:install_buildpacks) BackgroundJobEnvironment.new(RakeConfig.config).setup_environment do VCAP::CloudController::InstallBuildpacks.new(RakeConfig.config).install(buildpacks) e...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/tasks/gem_freshness.rake
Ruby
apache-2.0
203
main
3,929
# rubocop:disable Metrics/BlockLength namespace :gem_freshness do desc 'Generate a report of gem freshness' task report: :environment do require 'bundler' require 'net/http' require 'oj' require 'date' require 'rubygems/version' GEMFILE = ENV.fetch('GEMFILE', 'Gemfile') LOCKFILE = ENV.f...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/tasks/stack_check.rake
Ruby
apache-2.0
203
main
432
namespace :stacks do desc 'Check Installed Stacks' task stack_check: :environment do logger = Steno.logger('cc.stack') db = VCAP::CloudController::DB.connect(RakeConfig.config.get(:db), logger) next unless db.table_exists?(:stacks) require 'models/helpers/stack_config_file' require 'cloud_contr...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/tasks/route_syncer.rake
Ruby
apache-2.0
203
main
214
namespace :route_syncer do desc 'Start a recurring route sync' task start: :environment do RakeConfig.context = :route_syncer BackgroundJobEnvironment.new(RakeConfig.config).setup_environment end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/tasks/jobs.rake
Ruby
apache-2.0
203
main
2,925
require 'delayed_job/quit_trap' require 'delayed_job/delayed_worker' namespace :jobs do desc 'Clear the delayed_job queue.' task clear: :environment do RakeConfig.context = :worker BackgroundJobEnvironment.new(RakeConfig.config).setup_environment(RakeConfig.config.get(:readiness_port, ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/tasks/deployment_updater.rake
Ruby
apache-2.0
203
main
732
namespace :deployment_updater do desc 'Start a recurring process to perform zero downtime deployments' task start: :environment do puts RUBY_DESCRIPTION require 'cloud_controller/deployment_updater/scheduler' require 'cloud_controller/execution_context' VCAP::CloudController::ExecutionContext::DEPL...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/tasks/db.rake
Ruby
apache-2.0
203
main
12,186
require 'httpclient' namespace :db do desc 'Create a Sequel migration in ./db/migrate' task create_migration: :environment do RakeConfig.context = :migrate name = ENV.fetch('NAME', nil) abort('no NAME specified. use `rake db:create_migration NAME=add_users`') unless name migrations_dir = File.joi...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/vcap/request.rb
Ruby
apache-2.0
203
main
2,477
module VCAP module Request HEADER_NAME = 'X-VCAP-Request-ID'.freeze HEADER_BROKER_API_VERSION = 'X-Broker-Api-Version'.freeze HEADER_API_INFO_LOCATION = 'X-Api-Info-Location'.freeze HEADER_BROKER_API_ORIGINATING_IDENTITY = 'X-Broker-Api-Originating-Identity'.freeze HEADER_BROKER_API_REQUEST_IDENTI...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/vcap/sequel_add_association_dependencies_monkeypatch.rb
Ruby
apache-2.0
203
main
1,070
require 'sequel' # The AssociationDependencies plugin allows you do easily set up before and/or after # destroy hooks for destroying, deleting, or nullifying associated model objects. # # However, the plugin has no way to return the association dependencies verbatim # and instead returns its own representation of the ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/vcap/pid_file.rb
Ruby
apache-2.0
203
main
1,668
require 'fileutils' require 'vcap/host_system' module VCAP class PidFile class ProcessRunningError < StandardError end def initialize(pid_file, create_parents=true) @pid_file = pid_file @dirty = true write(create_parents) end # Removes the created pidfile def unlink ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/vcap/stats.rb
Ruby
apache-2.0
203
main
1,206
require 'vcap/pid_file' require 'vmstat' module VCAP class Stats class << self def process_memory_bytes_and_cpu rss = [] pcpu = [] ps_out = ps_pid ps_out += ps_ppid if is_puma_webserver? ps_out.split.each_with_index { |e, i| i.even? ? rss << e : pcpu << e } ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/vcap/sequel_case_insensitive_string_monkeypatch.rb
Ruby
apache-2.0
203
main
2,482
require 'sequel' require 'sequel/adapters/postgres' require 'sequel/adapters/mysql2' # Add :case_insensitive as an option to the string type during migrations. # This results in case insensitive comparisions for indexing and querying, but # case preserving retrieval. # # This is probably not the best way of doing this...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/vcap/digester.rb
Ruby
apache-2.0
203
main
427
require 'openssl' class Digester ALGORITHM = OpenSSL::Digest::SHA1 TYPE = :hexdigest def initialize(algorithm: ALGORITHM, type: TYPE) @algorithm = algorithm @type = type end def digest(bits) algorithm.send(type, bits) end def digest_path(path) digest_file(File.new(path)) end def d...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/vcap/config.rb
Ruby
apache-2.0
203
main
1,228
require 'cloud_controller/yaml_config' require 'yaml' require 'membrane' require 'active_support' require 'active_support/core_ext' module VCAP class Config class << self attr_reader :schema attr_accessor :parent_schema def define_schema(&) @schema = Membrane::SchemaParser.parse(&) ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/vcap/host_system.rb
Ruby
apache-2.0
203
main
1,006
require 'socket' module VCAP class HostSystem def process_running?(pid) return false unless pid && (pid > 0) output = `ps -o rss= -p #{pid}` return true if $CHILD_STATUS == 0 && !output.empty? # fail otherwise.. false end def num_cores if RUBY_PLATFORM.match?(/linux...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/vcap/json_message.rb
Ruby
apache-2.0
203
main
3,985
# Copyright (c) 2009-2011 VMware, Inc require 'rubygems' require 'membrane' class JsonMessage # Base error class that all other JsonMessage related errors should # inherit from class Error < StandardError end # Fields not defined properly. class DefinitionError < Error end # Failed to parse json duri...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/vcap/semver_validator.rb
Ruby
apache-2.0
203
main
769
module VCAP module SemverValidator # regex credit: [DavidFichtmueller](https://github.com/DavidFichtmueller) # (https://github.com/semver/semver/issues/232#issuecomment-405596809) SEMVER_REGEX = / ^ (?<major>0|[1-9]\d*)\. (?<minor>0|[1-9]\d*)\. (?<patc...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/vcap/vars_builder.rb
Ruby
apache-2.0
203
main
2,128
module VCAP class VarsBuilder def initialize(process, memory_limit: nil, staging_disk_in_mb: nil, space: nil, file_descriptors: nil, version: nil) @process = process @staging_disk_in_mb = staging_disk_in_mb ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/vcap/rest_api/query.rb
Ruby
apache-2.0
203
main
7,798
require 'time' module VCAP::RestAPI # # Query against a model using a query string received via http query # parameters. # # Note: we use both a model and a dataset because we need to know properties # about the model. We also want to query against a potentially already # filtered dataset. Since datase...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/vcap/rest_api/attributes.rb
Ruby
apache-2.0
203
main
3,417
module VCAP::RestAPI # A NamedAttribute defines an attribute used in a rest controller # # These are ultimately used to capture the attributes allowed to be # fetched/set on a controller. These ultimately get used to auto-generate # a Membrane based json validator on a per request type basis. class NamedAt...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/vcap/rest_api/errors.rb
Ruby
apache-2.0
203
main
1,707
require 'vcap/rest_api/http_constants' module VCAP::RestAPI module Errors HTTP = VCAP::RestAPI::HTTP class Error < StandardError attr_reader :response_code, :error_code # Initialize a rest api error (not for direct use by callers) # # @param [Integer] response_code HTTP response cod...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/vcap/rest_api/message.rb
Ruby
apache-2.0
203
main
2,371
require 'vcap/json_message' module VCAP module RestAPI class Message < JsonMessage class UrlDecorator < SimpleDelegator def inspect 'String /URL_REGEX/' end alias_method :to_s, :inspect def default_error_message 'must be a valid URL' end en...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/vcap/rest_api/http_constants.rb
Ruby
apache-2.0
203
main
1,812
module VCAP::RestAPI module HTTP CONTINUE = 100 SWITCHING_PROTOCOL = 101 OK = 200 CREATED = 201 ACCEPTED = 202 NON_AUTHORITATIVE_INFORMATION = 203 NO_CONTENT ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/vcap/rest_api/event_query.rb
Ruby
apache-2.0
203
main
361
module VCAP::RestAPI # # Use this class to implement special-cases for querying against # the Event Controller class EventQuery < Query private def foreign_key_association(_key) # Don't admit events have an fkey association with spaces, as events can live # after an associated spaces has b...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/membrane/schema_parser.rb
Ruby
apache-2.0
203
main
4,839
# frozen_string_literal: true # Vendored from https://github.com/cloudfoundry/membrane # Modified for RuboCop compliance and Ruby 3.3 modernization require 'membrane/schemas' module Membrane end class Membrane::SchemaParser DEPARSE_INDENT = ' ' class Dsl OptionalKeyMarker = Struct.new(:key) Dictionary...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/membrane/schemas/value.rb
Ruby
apache-2.0
203
main
663
require 'membrane/errors' require 'membrane/schemas/base' module Membrane module Schema end end class Membrane::Schemas::Value < Membrane::Schemas::Base attr_reader :value def initialize(value) @value = value end def validate(object) ValueValidator.new(@value, object).validate end class Val...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/membrane/schemas/dictionary.rb
Ruby
apache-2.0
203
main
1,418
require 'membrane/errors' require 'membrane/schemas/base' module Membrane module Schema end end class Membrane::Schemas::Dictionary < Membrane::Schemas::Base attr_reader :key_schema, :value_schema def initialize(key_schema, value_schema) @key_schema = key_schema @value_schema = value_schema end ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/membrane/schemas/regexp.rb
Ruby
apache-2.0
203
main
1,090
require 'membrane/errors' require 'membrane/schemas/base' module Membrane module Schema end end class Membrane::Schemas::Regexp < Membrane::Schemas::Base attr_reader :regexp def initialize(regexp) @regexp = regexp end def validate(object) StringValidator.new(object).validate MatchValidator.n...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/membrane/schemas/class.rb
Ruby
apache-2.0
203
main
748
require 'membrane/errors' require 'membrane/schemas/base' class Membrane::Schemas::Class < Membrane::Schemas::Base attr_reader :klass def initialize(klass) @klass = klass end # Validates whether or not the supplied object is derived from klass def validate(object) ClassValidator.new(@klass, object)...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/membrane/schemas/enum.rb
Ruby
apache-2.0
203
main
1,015
require 'membrane/errors' require 'membrane/schemas/base' module Membrane module Schema end end class Membrane::Schemas::Enum < Membrane::Schemas::Base attr_reader :elem_schemas def initialize(*elem_schemas) @elem_schemas = elem_schemas end def validate(object) EnumValidator.new(@elem_schemas, o...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/membrane/schemas/record.rb
Ruby
apache-2.0
203
main
1,937
require 'membrane/errors' require 'membrane/schemas/base' module Membrane module Schema end end class Membrane::Schemas::Record < Membrane::Schemas::Base attr_reader :schemas, :optional_keys def initialize(schemas, optional_keys=[]) @optional_keys = Set.new(optional_keys) @schemas = schemas end ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/membrane/schemas/base.rb
Ruby
apache-2.0
203
main
350
class Membrane::Schemas::Base # Verifies whether or not the supplied object conforms to this schema # # @param [Object] The object being validated # # @raise [Membrane::SchemaValidationError] # # @return [nil] def validate(object) raise NotImplementedError end def deparse Membrane::SchemaP...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/membrane/schemas/bool.rb
Ruby
apache-2.0
203
main
567
require 'membrane/errors' require 'membrane/schemas/base' class Membrane::Schemas::Bool < Membrane::Schemas::Base def validate(object) BoolValidator.new(object).validate end class BoolValidator TRUTH_VALUES = Set.new([true, false]) def initialize(object) @object = object end def vali...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/membrane/schemas/list.rb
Ruby
apache-2.0
203
main
1,265
require 'membrane/errors' require 'membrane/schemas/base' module Membrane module Schema end end class Membrane::Schemas::List < Membrane::Schemas::Base attr_reader :elem_schema def initialize(elem_schema) @elem_schema = elem_schema end def validate(object) ArrayValidator.new(object).validate ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/membrane/schemas/tuple.rb
Ruby
apache-2.0
203
main
1,875
require 'membrane/errors' require 'membrane/schemas/base' module Membrane module Schema end end class Membrane::Schemas::Tuple < Membrane::Schemas::Base attr_reader :elem_schemas def initialize(*elem_schemas) @elem_schemas = elem_schemas end def validate(object) ArrayValidator.new(object).valida...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/loggregator-api/v2/ingress_pb.rb
Ruby
apache-2.0
203
main
1,388
# frozen_string_literal: true # Generated by the protocol buffer compiler. DO NOT EDIT! # source: loggregator-api/v2/ingress.proto require 'google/protobuf' require 'loggregator-api/v2/envelope_pb' descriptor_data = "\n loggregator-api/v2/ingress.proto\x12\x0eloggregator.v2\x1a!loggregator-api/v2/envelope.proto\"\...