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/loggregator-api/v2/envelope_pb.rb
Ruby
apache-2.0
203
main
3,663
# frozen_string_literal: true # Generated by the protocol buffer compiler. DO NOT EDIT! # source: loggregator-api/v2/envelope.proto require 'google/protobuf' descriptor_data = "\n!loggregator-api/v2/envelope.proto\x12\x0eloggregator.v2\"\xb5\x04\n\x08\x45nvelope\x12\x11\n\ttimestamp\x18\x01 \x01(\x03\x12\x1c\n\tsou...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/loggregator-api/v2/ingress_services_pb.rb
Ruby
apache-2.0
203
main
793
# Generated by the protocol buffer compiler. DO NOT EDIT! # Source: loggregator-api/v2/ingress.proto for package 'loggregator.v2' require 'grpc' require 'loggregator-api/v2/ingress_pb' module Loggregator module V2 module Ingress class Service include ::GRPC::GenericService self.marshal_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/delayed_job/quit_trap.rb
Ruby
apache-2.0
203
main
437
# Class 'Worker' in the 'delayed_job' gem only handles SIGTERM & SIGINT which result in a graceful shutdown # This monkey patch extends `start()` to also handle SIGQUIT. # Could be replaced by https://github.com/collectiveidea/delayed_job/pull/900 module QuitTrap def start trap('QUIT') do Thread.new { say ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/delayed_job/sequel_patch.rb
Ruby
apache-2.0
203
main
791
require 'delayed/backend/sequel' module Delayed module Backend module Sequel class Job # monkey patch to allow explicit configuration of job lock method def self.reserve(worker, max_run_time=Worker.max_run_time) ds = ready_to_run(worker.name, max_run_time) ds = ds.filte...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/delayed_job/threaded_worker.rb
Ruby
apache-2.0
203
main
3,542
module Delayed class ThreadedWorker < Delayed::Worker def initialize(options={}) super @num_threads = options[:num_threads] @grace_period_seconds = options.key?(:grace_period_seconds) ? options[:grace_period_seconds] : 30 @threads = [] @unexpected_error = false @mutex = Mutex.n...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/delayed_job/delayed_worker.rb
Ruby
apache-2.0
203
main
5,604
require 'delayed_job/threaded_worker' require 'rack' require 'puma' require 'prometheus/middleware/exporter' require 'cloud_controller/standalone_metrics_webserver' require 'loggregator_emitter/client' class CloudController::DelayedWorker DEFAULT_READ_AHEAD_POSTGRES = 0 DEFAULT_READ_AHEAD_MYSQL = Delayed::Worker::...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/logcache/ingress_services_pb.rb
Ruby
apache-2.0
203
main
771
# Generated by the protocol buffer compiler. DO NOT EDIT! # Source: logcache/ingress.proto for package 'logcache.v1' require 'grpc' require 'logcache/ingress_pb' module Logcache module V1 module Ingress # The ingress service is used to write data into the LogCache system. class Service inc...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/logcache/egress_pb.rb
Ruby
apache-2.0
203
main
2,656
# frozen_string_literal: true # Generated by the protocol buffer compiler. DO NOT EDIT! # source: logcache/egress.proto require 'google/protobuf' require 'loggregator-api/v2/envelope_pb' require 'google/api/annotations_pb' descriptor_data = "\n\x15logcache/egress.proto\x12\x0blogcache.v1\x1a!loggregator-api/v2/env...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/logcache/egress_services_pb.rb
Ruby
apache-2.0
203
main
703
# Generated by the protocol buffer compiler. DO NOT EDIT! # Source: logcache/egress.proto for package 'logcache.v1' require 'grpc' require 'logcache/egress_pb' module Logcache module V1 module Egress # The egress service is used to read data from the LogCache system. class Service include ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/logcache/promql_pb.rb
Ruby
apache-2.0
203
main
3,776
# frozen_string_literal: true # Generated by the protocol buffer compiler. DO NOT EDIT! # source: logcache/promql.proto require 'google/protobuf' require 'google/api/annotations_pb' descriptor_data = "\n\x15logcache/promql.proto\x12\x0blogcache.v1\x1a\x1cgoogle/api/annotations.proto\"\xf4\x06\n\x06PromQL\x1a\x32\n...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/logcache/promql_services_pb.rb
Ruby
apache-2.0
203
main
713
# Generated by the protocol buffer compiler. DO NOT EDIT! # Source: logcache/promql.proto for package 'logcache.v1' require 'grpc' require 'logcache/promql_pb' module Logcache module V1 module PromQLQuerier class Service include ::GRPC::GenericService self.marshal_class_method = :encode...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/logcache/client.rb
Ruby
apache-2.0
203
main
2,874
require 'logcache/egress_services_pb' require 'loggregator-api/v2/envelope_pb' module Logcache class Client MAX_LIMIT = 1000 DEFAULT_LIMIT = 100 def initialize(host:, port:, client_ca_path:, client_cert_path:, client_key_path:, tls_subject_name:) if client_ca_path client_ca = IO.read(clien...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/logcache/orchestration_pb.rb
Ruby
apache-2.0
203
main
2,872
# frozen_string_literal: true # Generated by the protocol buffer compiler. DO NOT EDIT! # source: logcache/orchestration.proto require 'google/protobuf' descriptor_data = "\n\x1clogcache/orchestration.proto\x12\x0blogcache.v1\"#\n\x05Range\x12\r\n\x05start\x18\x01 \x01(\x04\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x04\",\...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/logcache/container_metric_batcher.rb
Ruby
apache-2.0
203
main
3,929
require 'logcache/client' require 'utils/time_utils' require 'logcache/container_metric_batch' module Logcache class ContainerMetricBatcher MAX_REQUEST_COUNT = 100 def initialize(logcache_client) @logcache_client = logcache_client end def container_metrics(source_guid:, logcache_filter:) ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/logcache/ingress_pb.rb
Ruby
apache-2.0
203
main
995
# frozen_string_literal: true # Generated by the protocol buffer compiler. DO NOT EDIT! # source: logcache/ingress.proto require 'google/protobuf' require 'loggregator-api/v2/envelope_pb' descriptor_data = "\n\x16logcache/ingress.proto\x12\x0blogcache.v1\x1a!loggregator-api/v2/envelope.proto\"S\n\x0bSendRequest\x1...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/logcache/container_metric_batch.rb
Ruby
apache-2.0
203
main
267
module Logcache class ContainerMetricBatch attr_accessor :cpu_percentage, :cpu_entitlement_percentage, :memory_bytes, :disk_bytes, :log_rate, :disk_bytes_quota, :memory_bytes_quota, :log_rate_limit, :instance_index end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/logcache/orchestration_services_pb.rb
Ruby
apache-2.0
203
main
877
# Generated by the protocol buffer compiler. DO NOT EDIT! # Source: logcache/orchestration.proto for package 'logcache.v1' require 'grpc' require 'logcache/orchestration_pb' module Logcache module V1 module Orchestration class Service include ::GRPC::GenericService self.marshal_class_me...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/locket/lock_runner.rb
Ruby
apache-2.0
203
main
1,751
require 'steno/steno' require 'locket/locket_services_pb' module Locket class LockRunner class Error < StandardError end def initialize(key:, owner:, host:, port:, client_ca_path:, client_cert_path:, client_key_path:) client_ca = File.read(client_ca_path) client_key = File.read(client_key_pa...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/locket/locket_services_pb.rb
Ruby
apache-2.0
203
main
699
# Generated by the protocol buffer compiler. DO NOT EDIT! # Source: locket/locket.proto for package 'models' require 'grpc' require 'locket/locket_pb' module Models module Locket class Service include ::GRPC::GenericService self.marshal_class_method = :encode self.unmarshal_class_method = :...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/locket/locket_pb.rb
Ruby
apache-2.0
203
main
2,740
# frozen_string_literal: true # Generated by the protocol buffer compiler. DO NOT EDIT! # source: locket/locket.proto require 'google/protobuf' descriptor_data = "\n\x13locket/locket.proto\x12\x06models\"l\n\x08Resource\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05owner\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/locket/lock_worker.rb
Ruby
apache-2.0
203
main
327
module Locket class LockWorker def initialize(lock_runner) @lock_runner = lock_runner end def acquire_lock_and_repeatedly_call(&block) @lock_runner.start loop do if @lock_runner.lock_acquired? yield block else sleep 1 end end end e...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/database/batch_delete.rb
Ruby
apache-2.0
203
main
480
module Database class BatchDelete attr_reader :amount, :dataset def initialize(dataset, amount=1000) @dataset = dataset @amount = amount end def delete total_count = 0 loop do set = dataset.limit(amount) break if set.empty? total_count += delete_batc...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/database/bigint_migration_step3ab.rb
Ruby
apache-2.0
203
main
3,321
require_relative 'bigint_migration' module VCAP::BigintMigration class << self def step3a_migration(migration, table) migration.up do if database_type == :postgres && !VCAP::BigintMigration.migration_completed?(self, table) && !VCAP::BigintMigration.migration_skipped?(self, ta...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/database/old_record_cleanup.rb
Ruby
apache-2.0
203
main
1,253
require 'database/batch_delete' module Database class OldRecordCleanup class NoCurrentTimestampError < StandardError; end attr_reader :model, :days_ago, :keep_at_least_one_record def initialize(model, days_ago, keep_at_least_one_record: false) @model = model @days_ago = days_ago @keep_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/database/bigint_migration.rb
Ruby
apache-2.0
203
main
6,535
module VCAP::BigintMigration class << self def opt_out? opt_out = VCAP::CloudController::Config.config&.get(:skip_bigint_id_migration) opt_out.nil? ? false : opt_out rescue VCAP::CloudController::Config::InvalidConfigPath false end def table_empty?(db, table) db[table].empty? ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/credhub/client.rb
Ruby
apache-2.0
203
main
2,568
module Credhub class Client def initialize(credhub_url, uaa_client) @credhub_url = credhub_url @uaa_client = uaa_client end def get_credential_by_name(reference_name) response = with_request_error_handling do client.get("/api/v1/data?name=#{reference_name}&current=true", nil, { ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/credhub/config_helpers.rb
Ruby
apache-2.0
203
main
398
module Credhub module ConfigHelpers def credhub_url credhub_url = ::VCAP::CloudController::Config.config.get(:credhub_api, :internal_url) return if credhub_url.blank? "{\"credhub-uri\":\"#{credhub_url}\"}" end def cred_interpolation_enabled? ::VCAP::CloudController::Config.config...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/encryptor.rb
Ruby
apache-2.0
203
main
6,503
require 'securerandom' require 'openssl' require 'openssl/cipher' require 'openssl/digest' require 'base64' module VCAP::CloudController module Encryptor ENCRYPTION_ITERATIONS = 2048 class EncryptorError < StandardError; end class << self ALGORITHM = 'AES-128-CBC'.freeze def generate_salt...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/install_buildpacks.rb
Ruby
apache-2.0
203
main
3,891
module VCAP::CloudController class InstallBuildpacks attr_reader :config def initialize(config) @config = config end def install(buildpacks) return unless buildpacks CloudController::DependencyLocator.instance.buildpack_blobstore.ensure_bucket_exists job_factory = VCAP::Clou...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/security_context.rb
Ruby
apache-2.0
203
main
1,654
module VCAP::CloudController module SecurityContext def self.clear Thread.current[:vcap_user] = nil Thread.current[:vcap_token] = nil Thread.current[:vcap_auth_token] = nil end def self.set(user, token=nil, auth_token=nil) Thread.current[:vcap_user] = user Thread.current[:vc...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/http_request_error.rb
Ruby
apache-2.0
203
main
331
class HttpRequestError < StructuredError attr_reader :uri, :method def initialize(msg, uri, method, nested_exception) super(msg, nested_exception) @uri = uri @method = method.to_s.upcase end def to_h hash = super hash['http'] = { 'uri' => uri, 'method' => method } hash...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/constants.rb
Ruby
apache-2.0
203
main
725
module VCAP::CloudController class Constants API_VERSION = File.read(File.expand_path('../../config/version_v2', File.dirname(__FILE__))).strip.freeze API_VERSION_V3 = File.read(File.expand_path('../../config/version', File.dirname(__FILE__))).strip.freeze OSBAPI_VERSION = File.read(File.expand_path('../....
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/diagnostics.rb
Ruby
apache-2.0
203
main
1,318
module VCAP::CloudController class Diagnostics def collect(output_directory) data = { time: Time.now.utc, threads: thread_data } FileUtils.mkdir_p(output_directory) output_file = File.join(output_directory, output_file_name) File.write(output_file, Oj.dump(data)) ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/execution_context.rb
Ruby
apache-2.0
203
main
1,686
module VCAP::CloudController class ExecutionContext ExecutionInfo = Struct.new(:process_type, :capi_job_name, :rake_context, keyword_init: true) do def initialize(process_type:, capi_job_name:, rake_context: nil) super end def set_process_type_env ENV['PROCESS_TYPE'] = process_t...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/resource_pool.rb
Ruby
apache-2.0
203
main
3,365
# A "resource" is typically represented as a Hash with two attributes: # :size (bytes) # :sha1 (string) # If there are other attributes, such as in legacy calls to "match_resources", # they will be ignored and preserved. require 'httpclient' require 'steno/steno' require 'cloud_controller/blobstore/fog/providers' requ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/stack_state_validator.rb
Ruby
apache-2.0
203
main
1,531
module VCAP::CloudController class StackStateValidator class StackValidationError < StandardError; end class DisabledStackError < StackValidationError; end class RestrictedStackError < StackValidationError; end def self.validate_for_new_app!(stack) return [] if stack.active? raise Disable...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/secrets_fetcher.rb
Ruby
apache-2.0
203
main
679
require 'cloud_controller/yaml_config' module VCAP::CloudController class SecretsFetcher class << self def fetch_secrets_from_file(secrets_file) secrets_refs = YAMLConfig.safe_load_file(secrets_file) traverse_secrets_hash(secrets_refs) end private def traverse_secrets_h...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/isolation_segment_selector.rb
Ruby
apache-2.0
203
main
556
module VCAP::CloudController class IsolationSegmentSelector class << self def for_space(space) if space.isolation_segment_model space.isolation_segment_model.name unless space.isolation_segment_model.is_shared_segment? else for_org(space.organization) end en...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/db.rb
Ruby
apache-2.0
203
main
10,195
require 'sequel' require 'cloud_controller/db_migrator' require 'cloud_controller/db_connection/options_factory' require 'cloud_controller/db_connection/finalizer' require 'cloud_controller/execution_context' require 'sequel/extensions/query_length_logging' require 'sequel/extensions/request_query_metrics' require 'seq...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/resource_pool_wrapper.rb
Ruby
apache-2.0
203
main
871
module VCAP::CloudController class ResourcePoolWrapper attr_reader :body def initialize(body) @body = body end def call fingerprints_all_clientside_bits = parse_fingerprints_in(body) fingerprints_existing_in_blobstore = ResourcePool.instance.match_resources(fingerprints_all_clients...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/background_job_environment.rb
Ruby
apache-2.0
203
main
971
require 'socket' class BackgroundJobEnvironment attr_reader :readiness_server def initialize(config) @config = config @log_counter = Steno::Sink::Counter.new VCAP::CloudController::StenoConfigurer.new(config.get(:logging)).configure do |steno_config_hash| steno_config_hash[:sinks] << @log_count...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/validate_database_keys.rb
Ruby
apache-2.0
203
main
5,589
module VCAP::CloudController module ValidateDatabaseKeys class ValidateDatabaseKeysError < StandardError; end class DatabaseEncryptionKeyMissingError < ValidateDatabaseKeysError; end class EncryptionKeySentinelMissingError < ValidateDatabaseKeysError; end class EncryptionKeySentinelDecryptionMismatchE...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/serializer.rb
Ruby
apache-2.0
203
main
1,213
module VCAP::CloudController::Serializer extend ActiveSupport::Concern module ClassMethods def serializes_via_json(accessor_method_name) define_method "#{accessor_method_name}_with_serialization" do string = send("#{accessor_method_name}_without_serialization") return if string.blank? ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/api_metrics_webserver.rb
Ruby
apache-2.0
203
main
2,859
require 'rack' require 'prometheus/middleware/exporter' module VCAP module CloudController class ApiMetricsWebserver attr_reader :app def initialize @app = build_app end def start(config) @server = Puma::Server.new(@app) if config.get(:nginx, :metrics_socket).ni...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/integer_array_serializer.rb
Ruby
apache-2.0
203
main
692
module VCAP::CloudController::IntegerArraySerializer def self.extended(_other) Sequel::Plugins::Serialization.register_format(:integer_array, serializer, deserializer) end def self.serializer lambda do |array| return nil if array.nil? raise ArgumentError.new('Integer array columns must be pas...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/standalone_metrics_webserver.rb
Ruby
apache-2.0
203
main
1,849
require 'cloud_controller/execution_context' module VCAP::CloudController class StandaloneMetricsWebserver def self.start_for_bosh_job(port) new(port).start end def initialize(port) @port = port end def start metrics_app = build_app Thread.new do server = Puma::...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/config.rb
Ruby
apache-2.0
203
main
6,181
require 'cloud_controller/account_capacity' require 'uri' require 'cloud_controller/backends/stagers' require 'cloud_controller/backends/runners' require 'cloud_controller/index_stopper' require 'cloud_controller/backends/instances_reporters' require 'repositories/service_event_repository' require 'cloud_controller/con...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/organization_instance_usage_calculator.rb
Ruby
apache-2.0
203
main
213
module VCAP::CloudController class OrganizationInstanceUsageCalculator def self.get_instance_usage(org) org.processes_dataset.where(state: ProcessModel::STARTED).sum(:instances) || 0 end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/rest_controller.rb
Ruby
apache-2.0
203
main
1,262
require 'controllers/base/base_controller' require 'controllers/base/model_controller' require 'cloud_controller/rest_controller/controller_dsl' require 'cloud_controller/rest_controller/secure_eager_loader' require 'cloud_controller/rest_controller/preloaded_object_serializer' require 'cloud_controller/rest_controller...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/membership.rb
Ruby
apache-2.0
203
main
4,346
module VCAP::CloudController class Membership SPACE_DEVELOPER = 'space_developer'.freeze SPACE_MANAGER = 'space_manager'.freeze SPACE_AUDITOR = 'space_auditor'.freeze SPACE_SUPPORTER = 'space_supporter'.freeze ORG_USER = 'organization_user'.freeze ORG_MANAGER = 'organization_manager'.freeze ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/structured_error.rb
Ruby
apache-2.0
203
main
698
class StructuredError < StandardError attr_reader :source attr_accessor :error_prefix def initialize(msg, source) super(msg) @source = source end def message "#{error_prefix}#{super}" end def to_h { 'description' => message, 'backtrace' => backtrace, 'source' => hashif...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/index_stopper.rb
Ruby
apache-2.0
203
main
226
module VCAP::CloudController class IndexStopper def initialize(runners) @runners = runners end def stop_index(process, index) @runners.runner_for_process(process).stop_index(index) end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/url_secret_obfuscator.rb
Ruby
apache-2.0
203
main
487
module CloudController class UrlSecretObfuscator def self.obfuscate(url) return nil if url.nil? begin parsed_url = URI.parse(url) rescue URI::InvalidURIError return url end if parsed_url.user parsed_url.user = VCAP::CloudController::Presenters::Censorship::R...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/route_validator.rb
Ruby
apache-2.0
203
main
2,786
module VCAP::CloudController class RouteValidator class ValidationError < StandardError; end class DomainInvalid < ValidationError; end class RouteInvalid < ValidationError; end class RoutePortTaken < ValidationError; end class InvalidRouteOptions < ValidationError; end attr_reader :route ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/jobs.rb
Ruby
apache-2.0
203
main
1,919
require 'jobs/cc_job' require 'jobs/delete_action_job' require 'jobs/space_apply_manifest_action_job' require 'jobs/enqueuer' require 'jobs/queues' require 'jobs/logging_context_job' require 'jobs/pollable_job_wrapper' require 'jobs/timeout_job' require 'jobs/error_translator_job' require 'jobs/diego/sync' require 'j...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/check_stacks.rb
Ruby
apache-2.0
203
main
949
module VCAP::CloudController class CheckStacks attr_reader :config def initialize(config, db) @config = config @stack_config = VCAP::CloudController::StackConfigFile.new(config.get(:stacks_file)) @db = db end def validate_stacks deprecated_stacks = @stack_config.deprecated_st...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/telemetry_logger.rb
Ruby
apache-2.0
203
main
1,463
require 'openssl' module VCAP::CloudController class TelemetryLogger INTEGER_FIELDS = %w[instance-count memory-in-mb disk-in-mb].freeze class << self def init(logger) @logger = logger end def v2_emit(event_name, entries, raw_entries={}) emit(event_name, entries, { 'api-vers...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/database_uri_generator.rb
Ruby
apache-2.0
203
main
918
module VCAP::CloudController class DatabaseUriGenerator VALID_DB_TYPES = %w[mysql mysql2 postgres postgresql].freeze RAILS_STYLE_DATABASE_TO_ADAPTER_MAPPING = { 'mysql' => 'mysql2', 'postgresql' => 'postgres' }.freeze def initialize(service_uris) @service_uris = service_uris || [] ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/process_observer.rb
Ruby
apache-2.0
203
main
1,997
module VCAP::CloudController module ProcessObserver class << self extend Forwardable def configure(stagers, runners) @stagers = stagers @runners = runners end def deleted(process) with_diego_communication_handling do @runners.runner_for_process(process)....
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/yaml_config.rb
Ruby
apache-2.0
203
main
244
require 'psych' module VCAP::CloudController class YAMLConfig class << self def safe_load_file(filepath) File.open(filepath) do |f| Psych.safe_load(f, strict_integer: true) end end end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/bits_expiration.rb
Ruby
apache-2.0
203
main
2,274
module VCAP::CloudController class BitsExpiration def initialize(config=Config.config) packages = config.get(:packages) droplets = config.get(:droplets) @packages_storage_count = packages[:max_valid_packages_stored] @droplets_storage_count = droplets[:max_staged_droplets_stored] end ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/port_generator.rb
Ruby
apache-2.0
203
main
642
module VCAP::CloudController class PortGenerator class << self def generate_port(domain_guid, possible_ports) domain = SharedDomain.where(guid: domain_guid).first router_group_guid = domain.router_group_guid unavailable_ports = Route.join(:domains, id: :domain_id). ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/diego.rb
Ruby
apache-2.0
203
main
372
require 'cloud_controller/diego/environment' require 'cloud_controller/diego/process_guid' require 'cloud_controller/diego/staging_request' require 'cloud_controller/diego/protocol/app_volume_mounts' require 'cloud_controller/diego/protocol/routing_info' require 'cloud_controller/diego/protocol/container_network_info' ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/icmp_rule_validator.rb
Ruby
apache-2.0
203
main
574
module CloudController class ICMPRuleValidator < RuleValidator self.required_fields += %w[code type] def self.validate(rule) errs = super return errs unless errs.empty? icmp_type = rule['type'] errs << 'contains invalid type' unless validate_icmp_control_message(icmp_type) icm...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/app_packager.rb
Ruby
apache-2.0
203
main
3,647
require 'find' require 'open3' require 'shellwords' require 'zip' require 'zip/filesystem' class AppPackager DIRECTORY_DELETE_BATCH_SIZE = 100 attr_reader :path def initialize(zip_path, logger: nil) @path = zip_path @logger = logger end def unzip(destination_dir) raise CloudController::Errors:...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/rack_app_builder.rb
Ruby
apache-2.0
203
main
3,974
require 'syslog/logger' require 'vcap_request_context_setter' require 'cors' require 'request_metrics' require 'request_logs' require 'cef_logs' require 'security_context_setter' require 'rate_limiter' require 'service_broker_rate_limiter' require 'rate_limiter_v2_api' require 'new_relic_custom_attributes' require 'zip...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/bosh_errand_environment.rb
Ruby
apache-2.0
203
main
483
class BoshErrandEnvironment def initialize(config) @config = config VCAP::CloudController::StenoConfigurer.new(config.get(:logging)).configure do |steno_config_hash| steno_config_hash[:sinks] << Steno::Sink::IO.new($stdout) if config.get(:logging, :stdout_sink_enabled) end end def setup_enviro...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/runner.rb
Ruby
apache-2.0
203
main
7,038
require 'steno/steno' require 'optparse' require 'cloud_controller/uaa/uaa_token_decoder' require 'cloud_controller/uaa/uaa_verification_keys' require 'app_log_emitter' require 'loggregator_emitter/client' require 'fluent_emitter' require 'cloud_controller/rack_app_builder' require 'cloud_controller/metrics/periodic_up...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/rule_validator.rb
Ruby
apache-2.0
203
main
4,015
module CloudController class RuleValidator class_attribute :required_fields, :optional_fields self.required_fields = %w[protocol destination] self.optional_fields = %w[log description] def self.validate(rule) errs = validate_fields(rule) return errs unless errs.empty? destination ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/account_capacity.rb
Ruby
apache-2.0
203
main
830
# port of legacy acount capacity model module VCAP::CloudController class AccountCapacity DEFAULT_MEM = 2 * 1024 # 8GB total DEFAULT_URIS = 4 # per app DEFAULT_SERVICES = 16 # total DEFAULT_APPS = 20 # total ADMIN_MEM = 32 * 1024 # 32GB total ADMIN_URIS ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/domain_decorator.rb
Ruby
apache-2.0
203
main
1,503
module CloudController class DomainDecorator DOMAIN_REGEX = /\A(([a-z0-9]|[a-z0-9][a-z0-9-]{0,61}[a-z0-9])\.)+([a-z0-9]|[a-z0-9][a-z0-9-]{0,61}[a-z0-9])\Z/ix DOMAIN_DELIMITER = '.'.freeze attr_reader :name def initialize(name) @name = name end def intermediate_domains return [] ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/controller_factory.rb
Ruby
apache-2.0
203
main
1,291
module CloudController class ControllerFactory include VCAP::CloudController def initialize(config, logger, env, params, body, sinatra=nil) @config = config @logger = logger @env = env @params = params @body = body @sinatra = sinatra end def create_contr...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/db_migrator.rb
Ruby
apache-2.0
203
main
3,591
require 'timeout' class DBMigrator MIGRATIONS_DIR = File.expand_path('../../db', File.dirname(__FILE__)) SEQUEL_MIGRATIONS = File.join(MIGRATIONS_DIR, 'migrations') def self.from_config(config, db_logger) config.load_db_encryption_key db = VCAP::CloudController::DB.connect(config.get(:db), db_logger) ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/process_route_handler.rb
Ruby
apache-2.0
203
main
1,714
module VCAP::CloudController class ProcessRouteHandler def initialize(process, runners=nil) @process = process @runners = runners || CloudController::DependencyLocator.instance.runners end def update_route_information(perform_validation: true, updated_ports: false) return unless @proces...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/resource_match.rb
Ruby
apache-2.0
203
main
2,638
module VCAP::CloudController class ResourceMatch attr_reader :descriptors FILE_SIZE_GROUPS = { '1KB or less': 0...1.kilobyte, '1KB to 100KB': 1.kilobyte...100.kilobytes, '100KB to 1MB': 100.kilobytes...1.megabyte, '1MB to 100MB': 1.megabyte...100.megabytes, '100MB to 1GB': 100.m...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/seeds.rb
Ruby
apache-2.0
203
main
7,235
require 'cloud_controller/adjective_noun_generator' module VCAP::CloudController module Seeds class << self def write_seed_data(config) create_seed_quota_definitions(config) create_seed_stacks create_seed_security_groups(config) system_org = create_seed_organizations(config)...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/controllers.rb
Ruby
apache-2.0
203
main
275
require 'cloud_controller/rest_controller' require 'controllers/v3/application_controller' Dir[File.expand_path('../../app/controllers/**/*.rb', __dir__)]. reject { |controller| controller.include? 'controllers/v3/application_controller' }. each { |file| require file }
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/user_audit_info.rb
Ruby
apache-2.0
203
main
534
module VCAP::CloudController class UserAuditInfo DATA_UNAVAILABLE = 'UNKNOWN'.freeze attr_reader :user_email, :user_name, :user_guid def initialize(user_email:, user_guid:, user_name: nil) @user_email = user_email || '' @user_name = user_name || '' @user_guid = user_guid end ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/permissions.rb
Ruby
apache-2.0
203
main
9,456
class VCAP::CloudController::Permissions ROLES_FOR_ORG_READING ||= [ VCAP::CloudController::Membership::ORG_MANAGER, VCAP::CloudController::Membership::ORG_AUDITOR, VCAP::CloudController::Membership::ORG_USER, VCAP::CloudController::Membership::ORG_BILLING_MANAGER ].freeze ROLES_FOR_ORG_CONTENT_R...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/roles.rb
Ruby
apache-2.0
203
main
1,919
module VCAP::CloudController class Roles CLOUD_CONTROLLER_ADMIN_SCOPE = 'cloud_controller.admin'.freeze CLOUD_CONTROLLER_ADMIN_READ_ONLY_SCOPE = 'cloud_controller.admin_read_only'.freeze CLOUD_CONTROLLER_GLOBAL_AUDITOR = 'cloud_controller.global_auditor'.freeze CLOUD_CONTROLLER_BUILD_STATE_UPDATER = '...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/file_path_checker.rb
Ruby
apache-2.0
203
main
264
module VCAP module CloudController class FilePathChecker def self.safe_path?(child_path, root_path=Dir.tmpdir) expanded_path = File.expand_path(child_path, root_path) !!expanded_path.match(/\A#{root_path}/) end end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/dependency_locator.rb
Ruby
apache-2.0
203
main
16,160
require 'repositories/app_event_repository' require 'repositories/build_event_repository' require 'repositories/space_event_repository' require 'repositories/organization_event_repository' require 'repositories/route_event_repository' require 'repositories/user_event_repository' require 'cloud_controller/rest_controlle...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/byte_quantity.rb
Ruby
apache-2.0
203
main
2,594
# Derived from the palm_civet library # Copyright (c) 2013 Anand Gaitonde # Licensed under the MIT License # https://github.com/goodmustache/palm_civet module VCAP module CloudController module ByteQuantity BYTE = 1.0 KILOBYTE = 1024 * BYTE MEGABYTE = 1024 * KILOBYTE GIGABYTE = 1024 *...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/transport_rule_validator.rb
Ruby
apache-2.0
203
main
1,060
module CloudController class TransportRuleValidator < RuleValidator self.required_fields += ['ports'] def self.validate(rule) errs = super return errs unless errs.empty? errs << 'contains invalid ports' unless validate_port(rule['ports']) errs end def self.validate_port(por...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/upload_buildpack.rb
Ruby
apache-2.0
203
main
3,133
require 'vcap/digester' require 'cloud_controller/diego/lifecycles/lifecycles' module VCAP::CloudController class UploadBuildpack attr_reader :buildpack_blobstore ONE_MEGABYTE = 1024 * 1024 def initialize(blobstore) @buildpack_blobstore = blobstore end def upload_buildpack(buildpack, bit...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/random_route_generator.rb
Ruby
apache-2.0
203
main
443
require 'cloud_controller/adjective_noun_generator' module VCAP::CloudController class RandomRouteGenerator def initialize @adjective_noun_generator = AdjectiveNounGenerator.new end def route ascii_letter_a = 97 first_letter = (rand(26) + ascii_letter_a).chr second_letter = (rand...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/organization_quota_usage.rb
Ruby
apache-2.0
203
main
823
module VCAP::CloudController class OrganizationQuotaUsage def initialize(organization) @organization = organization end def routes OrganizationRoutes.new(@organization).count end def service_instances @organization.managed_service_instances_dataset.count end def privat...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/adjective_noun_generator.rb
Ruby
apache-2.0
203
main
5,153
module VCAP::CloudController class AdjectiveNounGenerator ADJECTIVES = %w[accountable active agile anxious appreciative balanced bogus boisterous bold ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/http_response_error.rb
Ruby
apache-2.0
203
main
542
require 'cloud_controller/structured_error' class HttpResponseError < StructuredError attr_reader :uri, :method, :status, :response def initialize(message, method, response) @method = method.to_s.upcase @response = response @status = response.code.to_i begin source = Oj.load(response.body) ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/drain.rb
Ruby
apache-2.0
203
main
3,804
# This class is used in capi-release (e.g. https://github.com/cloudfoundry/capi-release/blob/b817791b0f4d8780304cef148f1aeb3f2a944af8/jobs/cloud_controller_ng/templates/shutdown_drain.rb.erb#L8) require 'logger' require 'fileutils' module VCAP module CloudController class Drain NGINX_FINAL_TIMEOUT = 10 ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/app_ssh_enabled.rb
Ruby
apache-2.0
203
main
259
module VCAP::CloudController class AppSshEnabled def initialize(app) @app = app end def enabled? Config.config.get(:allow_app_ssh_access) && app.space.allow_ssh && app.enable_ssh end private attr_reader :app end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/steno_configurer.rb
Ruby
apache-2.0
203
main
523
require 'steno/steno' module VCAP::CloudController class StenoConfigurer def initialize(logging_config) @config = logging_config || {} end def configure steno_config = Steno::Config.to_config_hash(@config) steno_config[:context] = Steno::Context::ThreadLocal.new steno_config[:cod...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/console.rb
Ruby
apache-2.0
203
main
1,677
#!/usr/bin/env ruby $LOAD_PATH.unshift(File.expand_path('../../lib', __dir__)) ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __dir__) require 'rubygems' require 'bundler/setup' require 'cloud_controller' require 'irb/completion' require 'pry' begin require File.expand_path('../../spec/support/bootstr...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/upload_handler.rb
Ruby
apache-2.0
203
main
1,300
class UploadHandler attr_reader :config class MissingFilePathError < StandardError end class InvalidFilePathError < StandardError end def initialize(config) @config = config end def uploaded_filename(params, resource_name) params["#{resource_name}_name"] end def uploaded_file(params, res...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/database_parts_parser.rb
Ruby
apache-2.0
203
main
959
module VCAP::CloudController class DatabasePartsParser class << self def database_parts_from_connection(connection_string) uri = URI.parse(connection_string) { adapter: uri.scheme, host: uri.host, port: uri.port, user: uri.user, password: uri...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blob_sender/missing_blob_handler.rb
Ruby
apache-2.0
203
main
519
module CloudController module BlobSender class MissingBlobHandler def handle_missing_blob!(app_guid, name) VCAP::AppLogEmitter.emit_error(app_guid, "Did not find #{name} for app with guid: #{app_guid}") logger.error "could not find #{name} for #{app_guid}" raise CloudController::Erro...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blob_sender/default_blob_sender.rb
Ruby
apache-2.0
203
main
336
module CloudController module BlobSender class DefaultLocalBlobSender def send_blob(blob, controller) path = blob.local_path logger.debug "send_file #{path}" controller.send_file(path) end def logger @logger ||= Steno.logger('cc.default_blob_sender') end ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blob_sender/nginx_blob_sender.rb
Ruby
apache-2.0
203
main
507
module CloudController module BlobSender class NginxLocalBlobSender def send_blob(blob, controller) url = blob.internal_download_url logger.debug "nginx redirect #{url}" return [200, { 'X-Accel-Redirect' => url }, ''] unless controller.is_a?(ActionController::Base) controll...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/diego/staging_request.rb
Ruby
apache-2.0
203
main
1,455
module VCAP::CloudController module Diego class StagingRequest attr_accessor :app_id, :file_descriptors, :memory_mb, :disk_mb, :environment, :isolation_segment, :egress_rules, :timeout, :log_guid, :lifecycle, :lifecycle_data, :completion_callback def message message = { ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/diego/task_recipe_builder.rb
Ruby
apache-2.0
203
main
8,193
require 'diego/action_builder' require 'cloud_controller/diego/lifecycle_bundle_uri_generator' require 'cloud_controller/diego/buildpack/task_action_builder' require 'cloud_controller/diego/docker/task_action_builder' require 'cloud_controller/diego/bbs_environment_builder' require 'cloud_controller/diego/task_completi...