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/cloud_controller/rest_controller/order_applicator.rb
Ruby
apache-2.0
203
main
840
module VCAP::CloudController::RestController class OrderApplicator def initialize(opts) @order_by = Array(opts[:order_by] || :id).map(&:to_sym) # symbols @order_direction = opts[:order_direction] || 'asc' end def apply(dataset) validate! if descending? @order_by.inject(da...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/rest_controller/messages.rb
Ruby
apache-2.0
203
main
1,818
module VCAP::CloudController::RestController # Auto generation of Message classes based on the attributes # exposed by a rest endpoint. module Messages extend ActiveSupport::Concern module ClassMethods # Define the messages exposed by a rest endpoint. def define_messages %i[create upd...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/config_schemas/deployment_updater_schema.rb
Ruby
apache-2.0
203
main
7,049
require 'vcap/config' module VCAP::CloudController module ConfigSchemas class DeploymentUpdaterSchema < VCAP::Config # rubocop:disable Metrics/BlockLength define_schema do { logging: { level: String, # debug, info, etc. file: String, # Log file to use ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/config_schemas/worker_schema.rb
Ruby
apache-2.0
203
main
9,448
require 'vcap/config' module VCAP::CloudController module ConfigSchemas class WorkerSchema < VCAP::Config # rubocop:disable Metrics/BlockLength define_schema do { external_port: Integer, external_domain: String, system_hostnames: [String], system_domain...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/config_schemas/migrate_schema.rb
Ruby
apache-2.0
203
main
1,728
require 'vcap/config' module VCAP::CloudController module ConfigSchemas class MigrateSchema < VCAP::Config define_schema do { optional(:max_migration_duration_in_minutes) => Integer, optional(:max_migration_statement_runtime_in_seconds) => Integer, optional(:migration_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/config_schemas/rotate_database_key_schema.rb
Ruby
apache-2.0
203
main
1,570
require 'vcap/config' module VCAP::CloudController module ConfigSchemas class RotateDatabaseKeySchema < VCAP::Config define_schema do { logging: { level: String, # debug, info, etc. file: String, # Log file to use syslog: String, # Name to associate wit...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/config_schemas/route_syncer_schema.rb
Ruby
apache-2.0
203
main
1,484
require 'vcap/config' module VCAP::CloudController module ConfigSchemas class RouteSyncerSchema < VCAP::Config define_schema do { logging: { level: String, # debug, info, etc. file: String, # Log file to use syslog: String # Name to associate with syslo...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/config_schemas/clock_schema.rb
Ruby
apache-2.0
203
main
8,797
require 'vcap/config' module VCAP::CloudController module ConfigSchemas class ClockSchema < VCAP::Config # rubocop:disable Metrics/BlockLength define_schema do { external_port: Integer, external_domain: String, tls_port: Integer, external_protocol: Stri...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/config_schemas/api_schema.rb
Ruby
apache-2.0
203
main
16,297
require 'vcap/config' require 'cloud_controller/resource_pool' module VCAP::CloudController module ConfigSchemas class ApiSchema < VCAP::Config # rubocop:disable Metrics/BlockLength define_schema do { external_port: Integer, external_domain: String, temporary_dis...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/config_schemas/blobstore_benchmarks_schema.rb
Ruby
apache-2.0
203
main
3,001
require 'vcap/config' module VCAP::CloudController module ConfigSchemas class BlobstoreBenchmarksSchema < VCAP::Config # rubocop:disable Metrics/BlockLength define_schema do blobstore_section = { blobstore_type: String, optional(:blobstore_provider) => String, o...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/job/job_priority_overwriter.rb
Ruby
apache-2.0
203
main
504
module VCAP::CloudController class JobPriorityOverwriter def initialize(config) @overwritten_job_priorities = config.get(:jobs, :priorities) end def get(job_name) return unless overwritten?(job_name) @overwritten_job_priorities[job_name.to_sym] end private def overwritten...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/packager/shared_bits_packer.rb
Ruby
apache-2.0
203
main
3,166
require 'shellwords' module CloudController module Packager module SharedBitsPacker private def package_zip_exists?(package_zip) package_zip && File.exist?(package_zip) end def validate_size!(app_packager) return unless max_package_size return unless app_package...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/packager/local_bits_packer.rb
Ruby
apache-2.0
203
main
1,508
require 'cloud_controller/blobstore/fingerprints_collection' require 'cloud_controller/app_packager' require 'cloud_controller/packager/shared_bits_packer' module CloudController module Packager class ConflictError < StandardError end class LocalBitsPacker include Packager::SharedBitsPacker ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/packager/package_upload_handler.rb
Ruby
apache-2.0
203
main
1,020
require 'cloud_controller/dependency_locator' module CloudController module Packager class PackageUploadHandler def initialize(package_guid, uploaded_files_path, cached_files_fingerprints) @package_guid = package_guid @uploaded_files_path = uploaded_files_path @ca...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/db_connection/options_factory.rb
Ruby
apache-2.0
203
main
1,563
require 'cloud_controller/db_connection/mysql_options_factory' require 'cloud_controller/db_connection/postgres_options_factory' module VCAP::CloudController module DbConnection class UnknownSchemeError < StandardError def initialize(scheme) @scheme = scheme end def to_s "Unkno...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/db_connection/finalizer.rb
Ruby
apache-2.0
203
main
673
module VCAP::CloudController module DbConnection class Finalizer def self.finalize(db_connection, connection_options, logger) db_connection.extension(:connection_validator) if connection_options[:log_db_queries] db_connection.logger = logger db_connection.sql_log_level =...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/db_connection/mysql_options_factory.rb
Ruby
apache-2.0
203
main
742
module VCAP::CloudController module DbConnection class MysqlOptionsFactory def self.build(opts) options = { charset: 'utf8' } options[:after_connect] = proc do |connection| connection.query("SET time_zone = '+0:00'") end if opts[:ca_cert_path] ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/db_connection/postgres_options_factory.rb
Ruby
apache-2.0
203
main
479
module VCAP::CloudController module DbConnection class PostgresOptionsFactory def self.build(opts) options = {} if opts[:ca_cert_path] options[:sslrootcert] = opts[:ca_cert_path] options[:sslmode] = opts[:ssl_verify_hostname] ? 'verify-full' : 'verify-ca' end ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/errors/api_error.rb
Ruby
apache-2.0
203
main
979
require 'cloud_controller/errors/details' module CloudController module Errors class ApiError < StandardError attr_accessor :args, :details, :error_prefix def self.new_from_details(name, *args) details = Details.new(name) new(details, args) end def initialize(details=nil...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/errors/no_running_instances.rb
Ruby
apache-2.0
203
main
245
module CloudController module Errors class NoRunningInstances < RuntimeError def initialize(wrapped_exception) @wrapped_exception = wrapped_exception end delegate :to_s, to: :@wrapped_exception end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/errors/instances_unavailable.rb
Ruby
apache-2.0
203
main
247
module CloudController module Errors class InstancesUnavailable < RuntimeError def initialize(wrapped_exception) @wrapped_exception = wrapped_exception end delegate :to_s, to: :@wrapped_exception end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/errors/invalid_auth_token.rb
Ruby
apache-2.0
203
main
333
module CloudController module Errors class InvalidAuthToken < RuntimeError def name 'InvalidAuthToken' end def response_code 401 end def message 'Invalid Auth Token' end def code 1000 end alias_method :error_code, :code e...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/errors/compound_error.rb
Ruby
apache-2.0
203
main
287
module CloudController module Errors class CompoundError < StandardError def initialize(errors) @errors = errors end def underlying_errors @errors end def response_code @errors.first.response_code end end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/errors/details.rb
Ruby
apache-2.0
203
main
1,394
require 'cloud_controller/yaml_config' module CloudController module Errors class DetailsLoader def self.load_by_code(yaml_file_path) VCAP::CloudController::YAMLConfig.safe_load_file(yaml_file_path) end def self.load_by_name(yaml_file_path) details_by_name = {} load_by_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/errors/api_error_helpers.rb
Ruby
apache-2.0
203
main
320
module CloudController module Errors module ApiErrorHelpers def api_error!(name, *) raise CloudController::Errors::ApiError.new_from_details(name, *) end def v3_api_error!(name, *) raise CloudController::Errors::V3::ApiError.new_from_details(name, *) end end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/errors/not_authenticated.rb
Ruby
apache-2.0
203
main
337
module CloudController module Errors class NotAuthenticated < RuntimeError def name 'NotAuthenticated' end def response_code 401 end def message 'Authentication error' end def code 10_002 end alias_method :error_code, :code ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/errors/v3/api_error.rb
Ruby
apache-2.0
203
main
341
require 'cloud_controller/errors/api_error' require 'cloud_controller/errors/v3/details' module CloudController module Errors module V3 class ApiError < Errors::ApiError def self.new_from_details(name, *args) details = V3::Details.new(name) new(details, args) end e...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/errors/v3/details.rb
Ruby
apache-2.0
203
main
603
require 'cloud_controller/yaml_config' require 'cloud_controller/errors/details' module CloudController module Errors module V3 class HardCodedDetails def self.yaml_file_path File.join(File.expand_path('../../../../errors', __dir__), 'v3.yml') end HARD_CODED_DETAILS = Det...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/deployments/deployment_target_state.rb
Ruby
apache-2.0
203
main
3,163
module VCAP::CloudController class DeploymentTargetState attr_reader :rollback_target_revision def initialize(app, message) @app = app @message = message @rollback_target_revision = @message.revision_guid && RevisionModel.find(guid: @message.revision_guid) end def droplet @dr...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/benchmark/blobstore.rb
Ruby
apache-2.0
203
main
5,993
# frozen_string_literal: true require 'benchmark' require 'find' require 'zip' require 'tempfile' require 'fileutils' require 'securerandom' module VCAP::CloudController module Benchmark class Blobstore SIZES = { '0.005MB' => (0.005 * 1024 * 1024).to_i, '0.01MB' => (0.01 * 1024 * 1024).to_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/null_client.rb
Ruby
apache-2.0
203
main
851
require 'cloud_controller/blobstore/base_client' module CloudController module Blobstore class NullClient < BaseClient def local? false end def exists?(_key) false end def download_from_blobstore(source_key, destination_path, mode: nil); end def cp_to_blobst...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/client.rb
Ruby
apache-2.0
203
main
838
require 'cloud_controller/blobstore/blob' module CloudController module Blobstore class Client extend Forwardable attr_reader :wrapped_client def initialize(client) @wrapped_client = client end def_delegators :@wrapped_client, :local?, ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/blob_key_generator.rb
Ruby
apache-2.0
203
main
319
module CloudController module Blobstore class BlobKeyGenerator def self.key_from_full_path(path) split_path = path.split(File::Separator) File.join(split_path.drop(2)) end def self.full_path_from_key(key) File.join(key[0..1], key[2..3], key) end end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/error_handling_client.rb
Ruby
apache-2.0
203
main
1,819
module CloudController module Blobstore class ErrorHandlingClient extend Forwardable def initialize(wrapped_client) @wrapped_client = wrapped_client end def_delegators :@wrapped_client, :local?, :root_dir def delete_all(*) ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/errors.rb
Ruby
apache-2.0
203
main
302
module CloudController module Blobstore class FileNotFound < StandardError end class BlobstoreError < StandardError end class ConflictError < StandardError end class UnsafeDelete < StandardError end class SigningRequestError < BlobstoreError end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/null_blob.rb
Ruby
apache-2.0
203
main
237
module CloudController module Blobstore class NullBlob < Blob def internal_download_url; end def public_download_url; end def attributes(*_keys) {} end def local_path; end end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/url_generator.rb
Ruby
apache-2.0
203
main
2,624
require 'cloud_controller/blobstore/url_generator/url_generator_helpers' require 'cloud_controller/blobstore/url_generator/upload_url_generator' require 'cloud_controller/blobstore/url_generator/internal_url_generator' require 'cloud_controller/blobstore/url_generator/local_url_generator' module CloudController modu...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/retryable_client.rb
Ruby
apache-2.0
203
main
4,463
require 'cloud_controller/blobstore/retryable_blob' module CloudController module Blobstore class RetryableClient extend Forwardable def initialize(client:, errors:, logger:, num_retries: 3) @wrapped_client = client @retryable_errors = errors @logger = logger @num_r...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/safe_delete_client.rb
Ruby
apache-2.0
203
main
1,188
module CloudController module Blobstore class SafeDeleteClient extend Forwardable attr_reader :wrapped_client def initialize(client, root_dir) @wrapped_client = client @root_dir = root_dir end def delete_all(*) raise UnsafeDelete.new('it is only safe ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/client_provider.rb
Ruby
apache-2.0
203
main
4,471
require 'cloud_controller/blobstore/client' require 'cloud_controller/blobstore/retryable_client' require 'cloud_controller/blobstore/fog/fog_client' require 'cloud_controller/blobstore/error_handling_client' require 'cloud_controller/blobstore/webdav/dav_client' require 'cloud_controller/blobstore/local/local_client' ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/base_client.rb
Ruby
apache-2.0
203
main
1,029
require 'cloud_controller/blobstore/blob' require 'cloud_controller/blobstore/blob_key_generator' module CloudController module Blobstore class BaseClient def cp_r_to_blobstore(source_dir) Find.find(source_dir).each do |path| next unless File.file?(path) next unless within_limit...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/retryable_blob.rb
Ruby
apache-2.0
203
main
1,558
module CloudController module Blobstore class RetryableBlob < Blob extend Forwardable attr_reader :wrapped_blob, :retryable_errors, :logger, :num_retries def initialize(blob:, errors:, logger:, num_retries: 3) @wrapped_blob = blob @retryable_errors = errors @logger = lo...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/fingerprints_collection.rb
Ruby
apache-2.0
203
main
1,724
module CloudController module Blobstore class FingerprintsCollection def initialize(fingerprints, root_path) raise CloudController::Errors::ApiError.new_from_details('AppBitsUploadInvalid', 'invalid :resources') unless fingerprints.is_a?(Array) @fingerprints = fingerprints @root_pat...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/webdav/dav_client.rb
Ruby
apache-2.0
203
main
8,737
require 'cloud_controller/blobstore/base_client' require 'cloud_controller/blobstore/errors' require 'cloud_controller/blobstore/webdav/dav_blob' require 'cloud_controller/blobstore/webdav/nginx_secure_link_signer' require 'cloud_controller/blobstore/webdav/http_client_provider' require 'nokogiri' module CloudControll...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/webdav/nginx_secure_link_signer.rb
Ruby
apache-2.0
203
main
2,773
require 'cloud_controller/blobstore/webdav/http_client_provider' module CloudController module Blobstore class NginxSecureLinkSigner def self.build(options:, directory_key:) NginxSecureLinkSigner.new( internal_endpoint: options[:private_endpoint], internal_path_prefix: directory...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/webdav/dav_blob.rb
Ruby
apache-2.0
203
main
1,006
require 'cloud_controller/blobstore/webdav/nginx_secure_link_signer' module CloudController module Blobstore class DavBlob < Blob attr_reader :key def initialize(httpmessage:, key:, signer:) @httpmessage = httpmessage @key = key @signer = signer end ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/webdav/http_client_provider.rb
Ruby
apache-2.0
203
main
668
module CloudController module Blobstore class HTTPClientProvider def self.provide(ca_cert_path: nil, connect_timeout: nil, receive_timeout: nil) client = HTTPClient.new client.connect_timeout = connect_timeout if connect_timeout client.receive_timeout = receive_timeout if receive_tim...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/url_generator/internal_url_generator.rb
Ruby
apache-2.0
203
main
1,992
require 'cloud_controller/blobstore/url_generator/url_generator_helpers' module CloudController module Blobstore class InternalUrlGenerator include UrlGeneratorHelpers def initialize(blobstore_options, package_blobstore, buildpack_cache_blobstore, admin_buildpack_blobstore, droplet_blobstore) ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/url_generator/url_generator_helpers.rb
Ruby
apache-2.0
203
main
867
module CloudController module Blobstore module UrlGeneratorHelpers def http_basic_auth_uri(path) uri = build_http_uri(path) uri.userinfo = [@blobstore_options[:user], @blobstore_options[:password]] uri.to_s end def http_no_auth_uri(path) build_http_uri(path).to_s...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/url_generator/upload_url_generator.rb
Ruby
apache-2.0
203
main
708
require 'cloud_controller/blobstore/url_generator/url_generator_helpers' module CloudController module Blobstore class UploadUrlGenerator include UrlGeneratorHelpers def initialize(blobstore_options) @blobstore_options = blobstore_options end def droplet_upload_url(droplet_guid)...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/url_generator/local_url_generator.rb
Ruby
apache-2.0
203
main
1,829
require 'cloud_controller/blobstore/url_generator/url_generator_helpers' module CloudController module Blobstore class LocalUrlGenerator include UrlGeneratorHelpers def initialize(blobstore_options, package_blobstore, buildpack_cache_blobstore, admin_buildpack_blobstore, droplet_blobstore) @...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/local/local_client.rb
Ruby
apache-2.0
203
main
5,443
require 'cloud_controller/blobstore/base_client' require 'cloud_controller/blobstore/errors' require 'cloud_controller/blobstore/local/local_blob' require 'fileutils' require 'digest' module CloudController module Blobstore class LocalClient < BaseClient attr_reader :root_dir def initialize( ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/local/local_blob.rb
Ruby
apache-2.0
203
main
851
require 'cloud_controller/blobstore/blob' require 'openssl' module CloudController module Blobstore class LocalBlob < Blob attr_reader :key def initialize(key:, file_path:) @key = key @file_path = file_path end def internal_download_url nil end ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/fog/providers.rb
Ruby
apache-2.0
203
main
398
require 'fog/core' # This can be removed once fog-google fixes # https://github.com/fog/fog-google/issues/421, which will allow us to upgrade # fog-core to 2.2.4. original = Fog::Logger[:deprecation] Fog::Logger[:deprecation] = nil require 'fog/aliyun' require 'fog/aws' require 'fog/local' require 'fog/google' requir...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/fog/fog_client.rb
Ruby
apache-2.0
203
main
6,472
require 'fileutils' require 'find' require 'mime-types' require 'cloud_controller/blobstore/fog/providers' require 'cloud_controller/blobstore/base_client' require 'cloud_controller/blobstore/fog/fog_blob' require 'cloud_controller/blobstore/fog/cdn' require 'cloud_controller/blobstore/errors' module CloudController ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/fog/cdn.rb
Ruby
apache-2.0
203
main
879
module CloudController module Blobstore class Cdn def self.make(host) return nil if host.nil? || host == '' new(host) end attr_reader :host def initialize(host) @host = host end def get(path, &block) retries = 0 begin client...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/fog/fog_blob.rb
Ruby
apache-2.0
203
main
747
module CloudController module Blobstore class FogBlob < Blob attr_reader :file def initialize(file, cdn) @file = file @cdn = cdn end def local_path file.send(:path) end def internal_download_url download_uri_for_file end def publi...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/storage_cli/storage_cli_client.rb
Ruby
apache-2.0
203
main
8,886
require 'open3' require 'tempfile' require 'tmpdir' require 'fileutils' require 'cloud_controller/blobstore/base_client' require 'cloud_controller/blobstore/storage_cli/storage_cli_blob' module CloudController module Blobstore class StorageCliClient < BaseClient attr_reader :root_dir, :min_size, :max_size ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/blobstore/storage_cli/storage_cli_blob.rb
Ruby
apache-2.0
203
main
1,071
module CloudController module Blobstore class StorageCliBlob < Blob attr_reader :key def initialize(key, properties: nil, signed_url: nil) @key = key @signed_url = signed_url if signed_url # Set properties to an empty hash if nil to avoid nil errors @properties = prope...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/paging/list_paginator.rb
Ruby
apache-2.0
203
main
1,244
module VCAP::CloudController class ListPaginator def get_page(list_dataset, pagination_options) page = pagination_options.page per_page = pagination_options.per_page order_by = pagination_options.order_by order_direction = pagination_options.order_direction sorted_list = sort_list(l...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/paging/paginated_result.rb
Ruby
apache-2.0
203
main
298
module VCAP::CloudController class PaginatedResult attr_reader :records, :total, :pagination_options def initialize(records, total, pagination_options) @records = records @total = total @pagination_options = pagination_options end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/paging/pagination_options.rb
Ruby
apache-2.0
203
main
1,569
require 'active_model' require 'mappers/order_by_mapper' module VCAP::CloudController class PaginationOptions include ActiveModel::Model PAGE_DEFAULT = 1 PER_PAGE_DEFAULT = 50 PER_PAGE_MAX = 5000 ORDER_DEFAULT = 'id'.freeze DIRECTION_DEFAULT = 'asc'.freeze VALID_DIRECTIONS...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/paging/sequel_paginator.rb
Ruby
apache-2.0
203
main
4,467
require 'cloud_controller/paging/paginated_result' module VCAP::CloudController class SequelPaginator def get_page(dataset, pagination_options) page = pagination_options.page per_page = pagination_options.per_page order_direction = pagination_options.order_direction order_by = pagination_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/buildpacks/stack_name_extractor.rb
Ruby
apache-2.0
203
main
938
module VCAP::CloudController module Buildpacks class StackNameExtractor ONE_MEGABYTE = 1024 * 1024 def self.extract_from_file(bits_file_path) bits_file_path = bits_file_path.path if bits_file_path.respond_to?(:path) Zip::File.open(bits_file_path) do |zip_file| zip_file.each ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/basic_auth/basic_auth_authenticator.rb
Ruby
apache-2.0
203
main
337
module CloudController module BasicAuth class BasicAuthAuthenticator def self.valid?(rack_env, credentials) auth = Rack::Auth::Basic::Request.new(rack_env) auth.provided? && auth.basic? && auth.credentials == credentials.map { |encoded_cred| CGI.unescape(encoded_cred) } end ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/app_services/process_log_rate_limit_calculator.rb
Ruby
apache-2.0
203
main
1,517
module VCAP::CloudController class ProcessLogRateLimitCalculator attr_reader :process def initialize(process) @process = process end def additional_log_rate_limit_requested return 0 if process.stopped? return QuotaDefinition::UNLIMITED if is_process_log_rate_unlimited? total...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/app_services/process_memory_calculator.rb
Ruby
apache-2.0
203
main
1,133
module VCAP::CloudController class ProcessMemoryCalculator attr_reader :process def initialize(process) @process = process end def additional_memory_requested return 0 if process.stopped? total_requested_memory - currently_used_memory end def total_requested_memory ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/app_manifest/manifest_route.rb
Ruby
apache-2.0
203
main
1,667
require 'addressable/uri' module VCAP::CloudController class ManifestRoute SUPPORTED_HTTP_SCHEMES = %w[http https unspecified].freeze SUPPORTED_TCP_SCHEMES = %w[tcp unspecified].freeze WILDCARD_HOST = '*'.freeze def self.parse(route, options=nil) parsed_uri = Addressable::URI.heuristic_parse(r...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/app_manifest/byte_converter.rb
Ruby
apache-2.0
203
main
1,310
require 'cloud_controller/byte_quantity' module VCAP::CloudController class ByteConverter class InvalidBytesError < StandardError; end class InvalidUnitsError < StandardError; end class NonNumericError < StandardError; end def convert_to_mb(human_readable_byte_value) return nil if human_readab...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/security/access_context.rb
Ruby
apache-2.0
203
main
708
require 'allowy/context' module VCAP::CloudController module Security class AccessContext include ::Allowy::Context attr_reader :queryer def initialize(queryer=nil) @queryer = queryer end def admin_override VCAP::CloudController::SecurityContext.admin? || VCAP::Cl...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/security/security_context_configurer.rb
Ruby
apache-2.0
203
main
2,797
module VCAP::CloudController module Security class SecurityContextConfigurer def initialize(token_decoder) @token_decoder = token_decoder end def configure(header_token) VCAP::CloudController::SecurityContext.clear decoded_token = decode_token(header_token) user...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/metrics/request_metrics.rb
Ruby
apache-2.0
203
main
804
require 'statsd' module VCAP::CloudController module Metrics class RequestMetrics def initialize(statsd_updater=CloudController::DependencyLocator.instance.statsd_updater, prometheus_updater=CloudController::DependencyLocator.instance.prometheus_updater) @statsd_updater = statsd_updater @pr...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/metrics/custom_process_id.rb
Ruby
apache-2.0
203
main
873
# Storing the metrics of several worker processes on cc-worker VMs in a DirectFileStore residing in a single directory # did not work because the different processes are isolated by bpm and several processes used the same pid within their container. # This pid is used for the filename and resulted in corrupted data bec...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/metrics/periodic_updater.rb
Ruby
apache-2.0
203
main
7,147
require 'cloud_controller/metrics/statsd_updater' require 'vcap/stats' module VCAP::CloudController::Metrics class PeriodicUpdater UPDATE_TASK = Struct.new(:method_name, :interval) USER_COUNT_TASK = UPDATE_TASK.new(:update_user_count, 600).freeze JOB_QUEUE_LENGTH_TASK = UPDATE_TASK.new(:update_job_queue...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/metrics/prometheus_updater.rb
Ruby
apache-2.0
203
main
12,627
require 'prometheus/client' require 'prometheus/client/data_stores/direct_file_store' require 'cloud_controller/execution_context' module VCAP::CloudController::Metrics class PrometheusUpdater # We want to label worker metrics with the worker's pid. By default, this label is reserved # within the Prometheus:...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/metrics/statsd_updater.rb
Ruby
apache-2.0
203
main
5,454
require 'statsd' module VCAP::CloudController::Metrics class StatsdUpdater def initialize(statsd=CloudController::DependencyLocator.instance.statsd_client, redis_connection_pool_size: nil) @statsd = statsd @redis_connection_pool_size = redis_connection_pool_size end def update_deploying_coun...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/deployment_updater/updater.rb
Ruby
apache-2.0
203
main
2,758
require 'cloud_controller/deployment_updater/actions/scale' require 'cloud_controller/deployment_updater/actions/cancel' require 'cloud_controller/deployment_updater/actions/finalize' module VCAP::CloudController module DeploymentUpdater class Updater attr_reader :deployment, :logger def initialize(...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/deployment_updater/dispatcher.rb
Ruby
apache-2.0
203
main
1,581
require 'actions/process_restart' require 'cloud_controller/deployment_updater/updater' module VCAP::CloudController module DeploymentUpdater class Dispatcher class << self def dispatch logger = Steno.logger('cc.deployment_updater.update') logger.info('run-deployment-update') ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/deployment_updater/scheduler.rb
Ruby
apache-2.0
203
main
3,330
require 'cloud_controller/deployment_updater/dispatcher' require 'locket/lock_worker' require 'locket/lock_runner' require 'cloud_controller/standalone_metrics_webserver' module VCAP::CloudController module DeploymentUpdater class Scheduler class << self def start with_error_logging('cc.d...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/deployment_updater/actions/scale_down_canceled_processes.rb
Ruby
apache-2.0
203
main
926
module VCAP::CloudController module DeploymentUpdater module Actions class ScaleDownCanceledProcesses attr_reader :deployment def initialize(deployment) @deployment = deployment end def call superseded_processes.each { |p| p.lock!.update(instances: 0) } ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/deployment_updater/actions/scale_down_old_process.rb
Ruby
apache-2.0
203
main
858
module VCAP::CloudController module DeploymentUpdater module Actions class ScaleDownOldProcess attr_reader :deployment, :process, :app, :desired_instances def initialize(deployment, process, desired_instances) @deployment = deployment @app = deployment.app @pro...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/deployment_updater/actions/up_scaler.rb
Ruby
apache-2.0
203
main
1,919
module VCAP::CloudController module DeploymentUpdater module Actions class UpScaler attr_reader :deployment, :logger, :app, :interim_desired_instance_count def initialize(deployment, logger, interim_desired_instance_count, instance_count_summary) @deployment = deployment ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/deployment_updater/actions/scale.rb
Ruby
apache-2.0
203
main
2,621
require 'cloud_controller/deployment_updater/actions/scale_down_canceled_processes' require 'cloud_controller/deployment_updater/actions/finalize' require 'cloud_controller/deployment_updater/actions/down_scaler' require 'cloud_controller/deployment_updater/actions/up_scaler' require 'cloud_controller/diego/constants' ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/deployment_updater/actions/down_scaler.rb
Ruby
apache-2.0
203
main
1,642
require 'cloud_controller/deployment_updater/actions/scale_down_old_process' module VCAP::CloudController module DeploymentUpdater module Actions class DownScaler attr_reader :deployment, :logger, :app def initialize(deployment, logger, target_total_instance_count, routable_instance_count) ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/deployment_updater/actions/finalize.rb
Ruby
apache-2.0
203
main
1,452
module VCAP::CloudController module DeploymentUpdater module Actions class Finalize attr_reader :deployment, :deploying_web_process, :app def initialize(deployment) @deployment = deployment @app = deployment.app @deploying_web_process = deployment.deploying_web...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/deployment_updater/actions/cancel.rb
Ruby
apache-2.0
203
main
2,312
module VCAP::CloudController module DeploymentUpdater module Actions class Cancel attr_reader :deployment, :logger, :app, :deploying_web_process def initialize(deployment, logger) @deployment = deployment @logger = logger @app = deployment.app @deploy...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/clock/distributed_executor.rb
Ruby
apache-2.0
203
main
2,199
module VCAP::CloudController class DistributedExecutor def initialize @logger = Steno.logger('cc.clock') end def execute_job(name:, interval:, fudge:, timeout:) ensure_job_record_exists(name) need_to_run_job = nil job = nil ClockJob.db.transaction do job = ClockJob...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/clock/clock.rb
Ruby
apache-2.0
203
main
1,481
require 'clockwork' require 'cloud_controller/clock/distributed_scheduler' require 'cloud_controller/clock/inline_runner' module VCAP::CloudController class Clock FREQUENT_FUDGE_FACTOR = 1.second.freeze DAILY_FUDGE_FACTOR = 1.minute.freeze HIGH_PRIORITY = 0 MEDIUM_PRIORITY = 1 LOW_PRIORITY ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/clock/job_timeout_calculator.rb
Ruby
apache-2.0
203
main
858
module VCAP::CloudController class JobTimeoutCalculator JOBS_WITH_TIMEOUTS = %i[app_usage_events_cleanup blobstore_delete diego_sync].freeze QUEUES_WITH_TIMEOUT = %w[cc-generic].freeze def initialize(config) @config = config end def calculate(job_name, queue_name=nil) job_timeout(job...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/clock/distributed_scheduler.rb
Ruby
apache-2.0
203
main
521
require 'clockwork' require 'cloud_controller/clock/distributed_executor' module VCAP::CloudController class DistributedScheduler def schedule_periodic_job(name:, interval:, fudge:, at: nil, thread: nil, timeout: nil, &block) clock_opts = {} clock_opts[:at] = at if at clock_opts[:thread] =...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/clock/inline_runner.rb
Ruby
apache-2.0
203
main
604
module VCAP::CloudController module Jobs class InlineRunner < Enqueuer class << self def setup Delayed::Worker.delay_jobs = lambda do |job| unwrapped_job = unwrap_job(job.payload_object) !(unwrapped_job.respond_to?(:inline?) && unwrapped_job.inline?) end ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/cloud_controller/clock/scheduler.rb
Ruby
apache-2.0
203
main
4,457
require 'clockwork' require 'cloud_controller/clock/clock' require 'cloud_controller/clock/job_timeout_calculator' require 'cloud_controller/standalone_metrics_webserver' module VCAP::CloudController class Scheduler CLEANUPS = [ { name: 'app_usage_events', class: Jobs::Runtime::AppUsageEventsCleanup, time:...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/allowy/context.rb
Ruby
apache-2.0
203
main
1,258
# frozen_string_literal: true # Inlined from https://github.com/dnagir/allowy # See lib/allowy/README.md for details module Allowy # This module provides the default and common context for checking the permissions. # It is mixed into controllers and provides an easy way to reuse it # in other parts of the appli...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/allowy/registry.rb
Ruby
apache-2.0
203
main
1,324
# frozen_string_literal: true # Inlined from https://github.com/dnagir/allowy # See lib/allowy/README.md for details module Allowy # Registry maps objects to their corresponding Access classes. # Given a Space object, it finds SpaceAccess class automatically. class Registry def initialize(ctx, options={}) ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/allowy/allowy.rb
Ruby
apache-2.0
203
main
695
# frozen_string_literal: true # Inlined from https://github.com/dnagir/allowy # See lib/allowy/README.md for details require 'active_support' require 'active_support/core_ext' require 'active_support/concern' require 'active_support/inflector' require 'allowy/access_control' require 'allowy/registry' require 'allowy...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/allowy/access_control.rb
Ruby
apache-2.0
203
main
1,638
# frozen_string_literal: true # Inlined from https://github.com/dnagir/allowy # See lib/allowy/README.md for details module Allowy # This module provides the interface for implementing the access control actions. # In order to use it, mix it into a plain Ruby class and define methods ending with `?`. # # @exa...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/utils/workpool.rb
Ruby
apache-2.0
203
main
959
class WorkPool attr_reader :exceptions, :threads def initialize(size, store_exceptions: false) @size = size @store_exceptions = store_exceptions @queue = Queue.new @exceptions = [] @lock = Mutex.new @threads = Array.new(@size) do create_workpool_thread end end def submit(*ar...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/utils/uri_utils.rb
Ruby
apache-2.0
203
main
4,040
require 'uri' module UriUtils SSH_REGEX = %r{ \A (?:ssh://)? git@ .+? : .+? \.git \z }x GIT_REGEX = %r{ \A git:// .+? : .+? \.git \z }x DOCKER_INDEX_SERVER = 'docker.io'.freeze DOCKER_PATH_REGEX = %r{\A[a-z0-9_\-./]{2,255}\Z} DOCKER_TAG_REGEX = /[a-zA-Z0-9_\-.]{1,128}/ DOCKER_DIGEST_REGEX = /sha256:[a-z0-9...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
lib/utils/hash_utils.rb
Ruby
apache-2.0
203
main
446
module HashUtils # #dig is a more-permissive alternative to Hash#dig # # HashUtils.dig(nil, 5) does not raise # nil.dig(5) raises # # HashUtils.dig('foo', :foo) does not raise # 'foo'.dig(:foo) raises # # HashUtils.dig({foo: 5}, :foo, :bar) does not raise # {foo: 5}.dig(:foo, :bar) raises def self...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20150422000255_route_path_field.rb
Ruby
apache-2.0
203
main
232
Sequel.migration do change do alter_table :routes do add_column :path, 'varchar(255)', default: '', null: false drop_index %i[host domain_id] add_index %i[host domain_id path], unique: true end end end