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
app/models/runtime/pollable_job_model.rb
Ruby
apache-2.0
203
main
1,646
module VCAP::CloudController class PollableJobModel < Sequel::Model(:jobs) PROCESSING_STATE = 'PROCESSING'.freeze COMPLETE_STATE = 'COMPLETE'.freeze FAILED_STATE = 'FAILED'.freeze POLLING_STATE = 'POLLING'.freeze one_to_many :warnings, class: 'VCAP::CloudController::JobWarningModel', key: :job_id...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/organization_auditor.rb
Ruby
apache-2.0
203
main
212
module VCAP::CloudController class OrganizationAuditor < Sequel::Model(:organizations_auditors) include OrganizationRoleMixin def type @type ||= RoleTypes::ORGANIZATION_AUDITOR end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/deployment_model.rb
Ruby
apache-2.0
203
main
5,026
module VCAP::CloudController class DeploymentModel < Sequel::Model(:deployments) plugin :serialization DEPLOYMENT_STATES = [ DEPLOYING_STATE = 'DEPLOYING'.freeze, PREPAUSED_STATE = 'PREPAUSED'.freeze, PAUSED_STATE = 'PAUSED'.freeze, DEPLOYED_STATE = 'DEPLOYED'.freeze, CANCELING_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/buildpack_lifecycle_buildpack_model.rb
Ruby
apache-2.0
203
main
1,575
require 'utils/uri_utils' module VCAP::CloudController class BuildpackLifecycleBuildpackModel < Sequel::Model(:buildpack_lifecycle_buildpacks) set_field_as_encrypted :buildpack_url, salt: :encrypted_buildpack_url_salt, column: :encrypted_buildpack_url many_to_one :buildpack_lifecycle_data, c...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/cnb_lifecycle_data_model.rb
Ruby
apache-2.0
203
main
4,337
require 'cloud_controller/diego/lifecycles/lifecycles' require 'presenters/helpers/censorship' module VCAP::CloudController class CNBLifecycleDataModel < Sequel::Model(:cnb_lifecycle_data) LIFECYCLE_TYPE = Lifecycles::CNB set_field_as_encrypted :registry_credentials_json, salt: :encrypted_registry_credential...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/route.rb
Ruby
apache-2.0
203
main
13,831
require 'utils/uri_utils' require 'models/helpers/process_types' require 'cloud_controller/routing_api/disabled_routing_api_client' require 'cloud_controller/route_validator' require 'actions/services/route_binding_delete' module VCAP::CloudController class Route < Sequel::Model class InvalidOrganizationRelation...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/service_instance_label_model.rb
Ruby
apache-2.0
203
main
365
module VCAP::CloudController class ServiceInstanceLabelModel < Sequel::Model(:service_instance_labels) many_to_one :service_instance, class: 'VCAP::CloudController::ServiceInstance', primary_key: :guid, key: :resource_guid, without_guid_generation: t...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/route_label_model.rb
Ruby
apache-2.0
203
main
268
module VCAP::CloudController class RouteLabelModel < Sequel::Model(:route_labels) many_to_one :route, primary_key: :guid, key: :resource_guid, without_guid_generation: true include MetadataModelMixin end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/stack_annotation_model.rb
Ruby
apache-2.0
203
main
358
module VCAP::CloudController class StackAnnotationModel < Sequel::Model(:stack_annotations) set_primary_key :id many_to_one :stack, class: 'VCAP::CloudController::Stack', primary_key: :guid, key: :resource_guid, without_guid_generation: true ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/task_model.rb
Ruby
apache-2.0
203
main
5,158
module VCAP::CloudController class TaskModel < Sequel::Model(:tasks) include Serializer TASK_NAME_REGEX = /\A[[:alnum:][:punct:][:print:]]+\Z/ TASK_STATES = [ SUCCEEDED_STATE = 'SUCCEEDED'.freeze, FAILED_STATE = 'FAILED'.freeze, PENDING_STATE = 'PENDING'.freeze, RUNNING_STATE = 'R...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/package_model.rb
Ruby
apache-2.0
203
main
3,185
module VCAP::CloudController class PackageModel < Sequel::Model(:packages) PACKAGE_STATES = [ PENDING_STATE = 'PROCESSING_UPLOAD'.freeze, READY_STATE = 'READY'.freeze, FAILED_STATE = 'FAILED'.freeze, CREATED_STATE = 'AWAITING_UPLOAD'.freeze, COPYING_STATE = 'COPYING'.freeze, ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/feature_flag.rb
Ruby
apache-2.0
203
main
4,075
module VCAP::CloudController class FeatureFlag < Sequel::Model FF_ERROR_MESSAGE_REGEX = /\A[[:alnum:][:punct:][:print:]]+\Z/ class UndefinedFeatureFlagError < StandardError end DEFAULT_FLAGS = { user_org_creation: false, private_domain_creation: true, app_bits_upload: true, a...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/buildpack_lifecycle_data_model.rb
Ruby
apache-2.0
203
main
5,277
require 'cloud_controller/diego/lifecycles/lifecycles' require 'utils/uri_utils' module VCAP::CloudController class BuildpackLifecycleDataModel < Sequel::Model(:buildpack_lifecycle_data) LIFECYCLE_TYPE = Lifecycles::BUILDPACK set_field_as_encrypted :buildpack_url, salt: :encrypted_buildpack_url_salt, column...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/security_group.rb
Ruby
apache-2.0
203
main
3,743
require 'netaddr' module VCAP::CloudController class SecurityGroup < Sequel::Model SECURITY_GROUP_NAME_REGEX = /\A[[:alnum:][:punct:][:print:]]+\Z/ MAX_RULES_CHAR_LENGTH = (2**24) - 1 plugin :serialization import_attributes :name, :rules, :running_default, :staging_default, :space_guids export_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/app_label_model.rb
Ruby
apache-2.0
203
main
320
module VCAP::CloudController class AppLabelModel < Sequel::Model(:app_labels) many_to_one :app, class: 'VCAP::CloudController::AppModel', primary_key: :guid, key: :resource_guid, without_guid_generation: true include MetadataModelMixin end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/organization_routes.rb
Ruby
apache-2.0
203
main
290
class OrganizationRoutes def initialize(organization) @organization = organization end delegate :count, to: :dataset private def dataset VCAP::CloudController::Route.dataset.join(:spaces, id: :space_id). where(spaces__organization_id: @organization.id) end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/user.rb
Ruby
apache-2.0
203
main
9,232
module VCAP::CloudController class User < Sequel::Model class InvalidOrganizationRelation < CloudController::Errors::InvalidRelation end attr_accessor :username, :organization_roles, :space_roles, :origin no_auto_guid many_to_many :organizations, before_remove: :validate_organiz...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/job_warning_model.rb
Ruby
apache-2.0
203
main
237
module VCAP::CloudController class JobWarningModel < Sequel::Model(:job_warnings) many_to_one :job, class: 'VCAP::CloudController::PollableJobModel' import_attributes :detail, :job_guid export_attributes :detail end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/revision_annotation_model.rb
Ruby
apache-2.0
203
main
375
module VCAP::CloudController class RevisionAnnotationModel < Sequel::Model(:revision_annotations) set_primary_key :id many_to_one :revision, class: 'VCAP::CloudController::RevisionModel', primary_key: :guid, key: :resource_guid, without_guid_gene...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/app_annotation_model.rb
Ruby
apache-2.0
203
main
355
module VCAP::CloudController class AppAnnotationModel < Sequel::Model(:app_annotations) set_primary_key :id many_to_one :app, class: 'VCAP::CloudController::AppModel', primary_key: :guid, key: :resource_guid, without_guid_generation: true in...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/droplet_label_model.rb
Ruby
apache-2.0
203
main
336
module VCAP::CloudController class DropletLabelModel < Sequel::Model(:droplet_labels) many_to_one :droplet, class: 'VCAP::CloudController::DropletModel', primary_key: :guid, key: :resource_guid, without_guid_generation: true include MetadataModel...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/sidecar_model.rb
Ruby
apache-2.0
203
main
1,177
module VCAP::CloudController class SidecarModel < Sequel::Model(:sidecars) include SidecarMixin ORIGIN_USER = 'user'.freeze ORIGIN_BUILDPACK = 'buildpack'.freeze many_to_one :app, class: 'VCAP::CloudController::AppModel', key: :app_guid, primary_key: :...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/auto_detection_buildpack.rb
Ruby
apache-2.0
203
main
503
module VCAP::CloudController class AutoDetectionBuildpack def valid? true end def errors [] end def staging_message {} end def key nil end def eql?(other) other.nil? || other.is_a?(AutoDetectionBuildpack) end alias_method :==, :eql? d...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/route_mapping_model.rb
Ruby
apache-2.0
203
main
2,677
module VCAP::CloudController class RouteMappingModel < Sequel::Model(:route_mappings) DEFAULT_PROTOCOL_MAPPING = { 'tcp' => 'tcp', 'http' => 'http1' }.freeze VALID_PROTOCOLS = %w[http1 http2 tcp].freeze many_to_one :app, class: 'VCAP::CloudController::AppModel', key: :app_guid, prim...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/space_label_model.rb
Ruby
apache-2.0
203
main
323
module VCAP::CloudController class SpaceLabelModel < Sequel::Model(:space_labels) many_to_one :space, class: 'VCAP::CloudController::Space', primary_key: :guid, key: :resource_guid, without_guid_generation: true include MetadataModelMixin end e...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/process_annotation_model.rb
Ruby
apache-2.0
203
main
371
module VCAP::CloudController class ProcessAnnotationModel < Sequel::Model(:process_annotations) set_primary_key :id many_to_one :process, class: 'VCAP::CloudController::ProcessModel', primary_key: :guid, key: :resource_guid, without_guid_generati...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/route_annotation_model.rb
Ruby
apache-2.0
203
main
303
module VCAP::CloudController class RouteAnnotationModel < Sequel::Model(:route_annotations) set_primary_key :id many_to_one :route, primary_key: :guid, key: :resource_guid, without_guid_generation: true include MetadataModelMixin end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/revision_sidecar_process_type_model.rb
Ruby
apache-2.0
203
main
900
module VCAP::CloudController class RevisionSidecarProcessTypeModel < Sequel::Model(:revision_sidecar_process_types) many_to_one :revision_sidecar, class: 'VCAP::CloudController::RevisionSidecarModel', primary_key: :guid, key: :revision_sidecar_guid, ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/shared_domain.rb
Ruby
apache-2.0
203
main
2,526
require 'models/runtime/domain' require 'cloud_controller/routing_api/routing_api_client' module VCAP::CloudController class SharedDomain < Domain set_dataset(shared_domains) add_association_dependencies routes: :destroy export_attributes :name, :internal, :router_group_guid, :router_group_type imp...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/isolation_segment_annotation_model.rb
Ruby
apache-2.0
203
main
404
module VCAP::CloudController class IsolationSegmentAnnotationModel < Sequel::Model(:isolation_segment_annotations) set_primary_key :id many_to_one :isolation_segment, class: 'VCAP::CloudController::IsolationSegment', primary_key: :guid, key: :resource_guid, ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/revision_label_model.rb
Ruby
apache-2.0
203
main
340
module VCAP::CloudController class RevisionLabelModel < Sequel::Model(:revision_labels) many_to_one :revision, class: 'VCAP::CloudController::RevisionModel', primary_key: :guid, key: :resource_guid, without_guid_generation: true include MetadataM...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/app_event.rb
Ruby
apache-2.0
203
main
669
module VCAP::CloudController class AppEvent < Sequel::Model many_to_one :app, class: 'VCAP::CloudController::ProcessModel' export_attributes :app_guid, :instance_guid, :instance_index, :exit_status, :exit_description, :timestamp import_attributes :app_guid, :instance_guid, :instance_index, :exit_status, ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/task_label_model.rb
Ruby
apache-2.0
203
main
324
module VCAP::CloudController class TaskLabelModel < Sequel::Model(:task_labels) many_to_one :task, class: 'VCAP::CloudController::TaskModel', primary_key: :guid, key: :resource_guid, without_guid_generation: true include MetadataModelMixin end ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/buildpack.rb
Ruby
apache-2.0
203
main
3,245
require 'cloud_controller/diego/lifecycles/lifecycles' module VCAP::CloudController class Buildpack < Sequel::Model plugin :list, scope: :lifecycle plugin :after_initialize export_attributes :name, :stack, :position, :enabled, :locked, :filename, :lifecycle import_attributes :name, :stack, :position...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/domain.rb
Ruby
apache-2.0
203
main
7,303
require 'cloud_controller/domain_decorator' module VCAP::CloudController class Domain < Sequel::Model class UnauthorizedAccessToPrivateDomain < RuntimeError; end # The maximum fully-qualified domain length is 255 including separators, but this includes two "invisible" # characters at the beginning and e...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/space_reserved_route_ports.rb
Ruby
apache-2.0
203
main
419
module VCAP::CloudController class SpaceReservedRoutePorts def initialize(space) @space = space end delegate :count, to: :dataset private def dataset Route.dataset.select_all(Route.table_name). join(Domain.table_name, id: :domain_id). where(space_id: @space.id). ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/user_label_model.rb
Ruby
apache-2.0
203
main
324
module VCAP::CloudController class UserLabelModel < Sequel::Model(:user_labels) many_to_one :user, class: 'VCAP::CloudController::UserModel', primary_key: :guid, key: :resource_guid, without_guid_generation: true include MetadataModelMixin end ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/process_label_model.rb
Ruby
apache-2.0
203
main
336
module VCAP::CloudController class ProcessLabelModel < Sequel::Model(:process_labels) many_to_one :process, class: 'VCAP::CloudController::ProcessModel', primary_key: :guid, key: :resource_guid, without_guid_generation: true include MetadataModel...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/domain_annotation_model.rb
Ruby
apache-2.0
203
main
367
module VCAP::CloudController class DomainAnnotationModel < Sequel::Model(:domain_annotations) set_primary_key :id many_to_one :domain, class: 'VCAP::CloudController::DomainModel', primary_key: :guid, key: :resource_guid, without_guid_generation: ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/build_annotation_model.rb
Ruby
apache-2.0
203
main
363
module VCAP::CloudController class BuildAnnotationModel < Sequel::Model(:build_annotations) set_primary_key :id many_to_one :build, class: 'VCAP::CloudController::BuildModel', primary_key: :guid, key: :resource_guid, without_guid_generation: true...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/quota_definition.rb
Ruby
apache-2.0
203
main
3,185
module VCAP::CloudController class QuotaDefinition < Sequel::Model UNLIMITED = -1 # Default values DEFAULT_NON_BASIC_SERVICES_ALLOWED = true DEFAULT_MEMORY_LIMIT = UNLIMITED DEFAULT_TOTAL_SERVICES = UNLIMITED DEFAULT_TOTAL_ROUTES = UNLIMITED one_to_many :organizations export_attribu...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/task_annotation_model.rb
Ruby
apache-2.0
203
main
359
module VCAP::CloudController class TaskAnnotationModel < Sequel::Model(:task_annotations) set_primary_key :id many_to_one :task, class: 'VCAP::CloudController::TaskModel', primary_key: :guid, key: :resource_guid, without_guid_generation: true ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/app_usage_event.rb
Ruby
apache-2.0
203
main
704
module VCAP::CloudController class AppUsageEvent < Sequel::Model plugin :serialization export_attributes :state, :previous_state, :memory_in_mb_per_instance, :previous_memory_in_mb_per_instance, :instance_count, :previous_instance_count, :app_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/custom_buildpack.rb
Ruby
apache-2.0
203
main
332
require 'utils/uri_utils' module VCAP::CloudController class CustomBuildpack < Struct.new(:url) def to_s url end def to_json(*_args) Oj.dump(url) end def staging_message { buildpack: url, buildpack_git_url: url } end def custom? true en...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/buildpack_annotation_model.rb
Ruby
apache-2.0
203
main
379
module VCAP::CloudController class BuildpackAnnotationModel < Sequel::Model(:buildpack_annotations) set_primary_key :id many_to_one :buildpack, class: 'VCAP::CloudController::BuildpackModel', primary_key: :guid, key: :resource_guid, without_guid_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/event.rb
Ruby
apache-2.0
203
main
2,730
module VCAP::CloudController class Event < Sequel::Model class EventValidationError < StandardError; end plugin :serialization many_to_one :space, primary_key: :guid, key: :space_guid, without_guid_generation: true def validate validates_presence :type validates_presence :timestamp ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/package_label_model.rb
Ruby
apache-2.0
203
main
336
module VCAP::CloudController class PackageLabelModel < Sequel::Model(:package_labels) many_to_one :package, class: 'VCAP::CloudController::PackageModel', primary_key: :guid, key: :resource_guid, without_guid_generation: true include MetadataModel...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/constraints/docker_policy.rb
Ruby
apache-2.0
203
main
561
class DockerPolicy BUILDPACK_DETECTED_ERROR_MSG = 'incompatible with buildpack'.freeze DOCKER_CREDENTIALS_ERROR_MSG = 'user, password and email required'.freeze def initialize(process) @errors = process.errors @process = process end def validate return unless @process.docker_image @errors.a...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/constraints/base_health_check_policy.rb
Ruby
apache-2.0
203
main
3,338
require 'models/helpers/health_check_types' require 'utils/uri_utils' # NOTE: nothing uses just the BaseHealthCheckPolicy. It is only used for # inheritance. class BaseHealthCheckPolicy def initialize(process, health_check_timeout, health_check_invocation_timeout, health_check_type, health_check_http_endpoint, healt...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/constraints/health_check_policy.rb
Ruby
apache-2.0
203
main
379
class HealthCheckPolicy < BaseHealthCheckPolicy private def is_health_check_type_port return true if @health_check_type == VCAP::CloudController::HealthCheckTypes::PORT # liveness and startup health checks default to type port, this results in the health check type # being stored as nil in the db r...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/constraints/process_user_policy.rb
Ruby
apache-2.0
203
main
698
class ProcessUserPolicy ERROR_MSG = 'invalid (requested user %<requested_user>s not allowed, permitted users are: %<allowed_users>s)'.freeze def initialize(process, allowed_users) @process = process @allowed_users = allowed_users @errors = process.errors end def validate return if @process.use...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/constraints/max_app_tasks_policy.rb
Ruby
apache-2.0
203
main
393
class MaxAppTasksPolicy def initialize(task, space_or_org, error_name) @task = task @space_or_org = space_or_org @error_name = error_name @errors = task.errors end def validate return unless @space_or_org return if @space_or_org.app_task_limit == -1 return unless @space_or_org.meets_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/constraints/instances_policy.rb
Ruby
apache-2.0
203
main
219
class InstancesPolicy def initialize(process) @process = process @errors = process.errors end def validate return unless @process.instances < 0 @errors.add(:instances, :less_than_zero) end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/constraints/max_disk_quota_policy.rb
Ruby
apache-2.0
203
main
451
class MaxDiskQuotaPolicy ERROR_MSG = 'too much disk requested (requested %<desired>s MB - must be less than %<max>s MB)'.freeze def initialize(process, max_mb) @process = process @errors = process.errors @max_mb = max_mb end def validate return unless @process.disk_quota return unless @pr...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/constraints/max_app_instances_policy.rb
Ruby
apache-2.0
203
main
822
class MaxAppInstancesPolicy attr_reader :quota_definition def initialize(process, space_or_org, quota_definition, error_name) @process = process @space_or_org = space_or_org @quota_definition = quota_definition @error_name = error_name @errors = process.errors end def validate return u...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/constraints/sidecar_memory_less_than_process_memory_policy.rb
Ruby
apache-2.0
203
main
847
class SidecarMemoryLessThanProcessMemoryPolicy attr_reader :new_memory, :processes, :message # memory represents the amount of memory to add to the total sidecar amount def initialize(processes, new_memory=0, existing_sidecar=nil) @new_memory = new_memory || 0 @processes = Array(processes) @existing_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/constraints/readiness_health_check_policy.rb
Ruby
apache-2.0
203
main
1,022
class ReadinessHealthCheckPolicy < BaseHealthCheckPolicy def initialize(process, health_check_invocation_timeout, health_check_type, health_check_http_endpoint, health_check_interval) super(process, nil, health_check_invocation_timeout, health_check_type, health_check_http_endpoint, health_check_interval) @va...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/constraints/min_log_rate_limit_policy.rb
Ruby
apache-2.0
203
main
372
class MinLogRateLimitPolicy ERROR_MSG = 'log_rate_limit must be greater than or equal to -1 (where -1 is unlimited)'.freeze def initialize(process) @process = process @errors = process.errors end def validate return unless @process.log_rate_limit return unless @process.log_rate_limit < -1 ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/constraints/max_log_rate_limit_policy.rb
Ruby
apache-2.0
203
main
2,305
require 'cloud_controller/app_services/process_log_rate_limit_calculator' class BaseMaxLogRateLimitPolicy def initialize(resource, policy_target, error_name) @resource = resource @policy_target = policy_target @error_name = error_name end def validate return unless policy_target return unles...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/constraints/min_disk_quota_policy.rb
Ruby
apache-2.0
203
main
335
class MinDiskQuotaPolicy ERROR_MSG = 'too little disk requested (must be greater than zero)'.freeze def initialize(process) @process = process @errors = process.errors end def validate return unless @process.disk_quota return unless @process.disk_quota < 1 @errors.add(:disk_quota, ERROR_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/constraints/max_memory_policy.rb
Ruby
apache-2.0
203
main
1,562
require 'cloud_controller/app_services/process_memory_calculator' class BaseMaxMemoryPolicy def initialize(resource, policy_target, error_name) @resource = resource @policy_target = policy_target @error_name = error_name end def validate return unless policy_target return unless additional_c...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/constraints/max_instance_memory_policy.rb
Ruby
apache-2.0
203
main
981
class BaseMaxInstanceMemoryPolicy def initialize(resource, policy_target, error_name) @resource = resource @policy_target = policy_target @error_name = error_name end def validate return unless policy_target return unless additional_checks return unless instance_memory_limit != VCAP::Clo...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/constraints/ports_policy.rb
Ruby
apache-2.0
203
main
1,431
class PortsPolicy def initialize(process) @process = process @errors = process.errors end def validate return if @process.ports.nil? || @process.ports.empty? return @errors.add('Process', 'must have at most 10 exposed ports.') if ports_limit_exceeded? return @errors.add('Po...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/helpers/space_role_mixin.rb
Ruby
apache-2.0
203
main
825
module VCAP::CloudController module SpaceRoleMixin def self.included(included_class) included_class.class_eval <<-RUBY, __FILE__, __LINE__ + 1 many_to_one :user many_to_one :space def_column_alias :guid, :role_guid RUBY end def before_create self.guid ||= Secure...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/helpers/sidecar_mixin.rb
Ruby
apache-2.0
203
main
252
module VCAP::CloudController module SidecarMixin def process_types sidecar_process_types.map(&:type).sort end def to_hash { name: name, command: command, types: process_types } end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/helpers/service_operation_mixin.rb
Ruby
apache-2.0
203
main
2,214
module VCAP::CloudController module ServiceOperationMixin CREATE = 'create'.freeze UPDATE = 'update'.freeze DELETE = 'delete'.freeze INITIAL = 'initial'.freeze IN_PROGRESS = 'in progress'.freeze SUCCEEDED = 'succeeded'.freeze FAILED = 'failed'.freeze def operation_in_progress? ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/helpers/organization_role_mixin.rb
Ruby
apache-2.0
203
main
832
module VCAP::CloudController module OrganizationRoleMixin def self.included(included_class) included_class.class_eval <<-RUBY, __FILE__, __LINE__ + 1 many_to_one :user many_to_one :organization def_column_alias :guid, :role_guid RUBY end def before_create self.g...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/helpers/package_state_calculator.rb
Ruby
apache-2.0
203
main
1,742
module VCAP::CloudController class PackageStateCalculator def initialize(process) @latest_build = process.latest_build @latest_droplet = process.latest_droplet @desired_droplet = process.desired_droplet @latest_package = process.latest_package end def calculate if process_ha...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/quota_constraints/max_service_instance_policy.rb
Ruby
apache-2.0
203
main
990
class MaxServiceInstancePolicy attr_reader :quota_definition def initialize(service_instance, existing_service_instance_count, quota_definition, error_name) @service_instance = service_instance @quota_definition = quota_definition @existing_service_instance_count = existing_service_instance_count @...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/quota_constraints/paid_service_instance_policy.rb
Ruby
apache-2.0
203
main
565
class PaidServiceInstancePolicy attr_reader :quota_definition def initialize(service_instance, quota_definition, error_name) @service_instance = service_instance @quota_definition = quota_definition @error_name = error_name @errors = service_instance.errors end def validate return unless @...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/quota_constraints/max_reserved_route_ports_policy.rb
Ruby
apache-2.0
203
main
751
module VCAP::CloudController class MaxReservedRoutePortsPolicy def initialize(quota_defintion, port_counter) @quota_definition = quota_defintion @port_counter = port_counter end def allow_more_route_ports? reservable_ports = @quota_definition.total_reserved_route_ports number_of_e...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/quota_constraints/max_routes_policy.rb
Ruby
apache-2.0
203
main
401
class MaxRoutesPolicy def initialize(quota_defintion, route_counter) @quota_definition = quota_defintion @route_counter = route_counter end def allow_more_routes?(number_of_new_routes) return true if @quota_definition.total_routes == -1 existing_total_routes = @route_counter.count @quota_def...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/quota_constraints/max_private_domains_policy.rb
Ruby
apache-2.0
203
main
508
class MaxPrivateDomainsPolicy def initialize(quota_defintion, private_domain_counter) @quota_definition = quota_defintion @private_domain_counter = private_domain_counter end def allow_more_private_domains?(number_of_new_private_domains) return true if @quota_definition.total_private_domains == -1 ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/models/runtime/quota_constraints/max_service_keys_policy.rb
Ruby
apache-2.0
203
main
783
class MaxServiceKeysPolicy attr_reader :quota_definition def initialize(service_key, existing_service_keys_dataset, quota_definition, error_name) @service_key = service_key @existing_service_keys_dataset = existing_service_keys_dataset @quota_definition = quota_definition @error_name = error_name ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/v2_error_hasher.rb
Ruby
apache-2.0
203
main
1,595
require 'presenters/base_error_hasher' class V2ErrorHasher < BaseErrorHasher UNKNOWN_ERROR_HASH = { 'error_code' => 'UnknownError', 'description' => 'An unknown error occurred.', 'code' => 10_001 }.freeze def unsanitized_hash return unknown_error_hash.dup if error.nil? payload = if api_erro...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/error_presenter.rb
Ruby
apache-2.0
203
main
883
require 'presenters/v2_error_hasher' class ErrorPresenter def initialize(error, test_mode=false, error_hasher=V2ErrorHasher.new(error)) @error = error @error_hasher = error_hasher @test_mode = test_mode end def client_error? response_code.between?(400, 499) end def log_message ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/api_url_builder.rb
Ruby
apache-2.0
203
main
351
module VCAP::CloudController::Presenters class ApiUrlBuilder def self.build_url(path: nil, query: nil) my_uri = URI::HTTP.build(host: VCAP::CloudController::Config.config.get(:external_domain), path: path, query: query) my_uri.scheme = VCAP::CloudController::Config.config.get(:external_protocol) ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/v3_error_hasher.rb
Ruby
apache-2.0
203
main
2,579
require 'presenters/base_error_hasher' class V3ErrorHasher < BaseErrorHasher UNKNOWN_ERROR_HASH = { 'title' => 'UnknownError', 'detail' => 'An unknown error occurred.', 'code' => 10_001 }.freeze def unsanitized_hash return { 'errors' => [UNKNOWN_ERROR_HASH.dup] } if error.nil? errors_payloa...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/base_error_hasher.rb
Ruby
apache-2.0
203
main
512
require 'cloud_controller/structured_error' class BaseErrorHasher < Struct.new(:error) def sanitized_hash unsanitized_hash.keep_if { |k, _| allowed_keys.include? k } end def unsanitized_hash {} end def compound_error? error.respond_to?(:underlying_errors) end def api_error? error.respo...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/helpers/censorship.rb
Ruby
apache-2.0
203
main
329
module VCAP module CloudController module Presenters module Censorship PRIVATE_DATA_HIDDEN = '[PRIVATE DATA HIDDEN]'.freeze PRIVATE_DATA_HIDDEN_LIST = '[PRIVATE DATA HIDDEN IN LISTS]'.freeze REDACTED = '[REDACTED]'.freeze REDACTED_CREDENTIAL = '***'.freeze end end ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/api/quota_definition_presenter.rb
Ruby
apache-2.0
203
main
596
require_relative 'api_presenter' class QuotaDefinitionPresenter < ApiPresenter def entity_hash { name: @object.name, non_basic_services_allowed: @object.non_basic_services_allowed, total_services: @object.total_services, memory_limit: @object.memory_limit, trial_db_allowed: false, ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/api/api_presenter.rb
Ruby
apache-2.0
203
main
437
class ApiPresenter def initialize(object) @object = object end def to_hash { metadata: metadata_hash, entity: entity_hash } end def to_json(*_args) Oj.dump(to_hash, mode: :compat) end protected def metadata_hash { guid: @object.guid, created_at: @object.cr...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/api/feature_flag_presenter.rb
Ruby
apache-2.0
203
main
473
require_relative 'api_presenter' class FeatureFlagPresenter < ApiPresenter def initialize(object, name, path) @object = object @name = name @path = path end def to_hash default_value = VCAP::CloudController::FeatureFlag::DEFAULT_FLAGS[@name.to_sym] { name: @name, enabled: @object...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/api/service_broker_presenter.rb
Ruby
apache-2.0
203
main
362
require_relative 'api_presenter' class ServiceBrokerPresenter < ApiPresenter def entity_hash { name: @object.name, broker_url: @object.broker_url, auth_username: @object.auth_username, space_guid: @object.space_guid } end def metadata_hash super.merge( url: "/v2/service...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/api/user_presenter.rb
Ruby
apache-2.0
203
main
221
require_relative 'api_presenter' class UserPresenter < ApiPresenter def entity_hash { admin: @object.admin, active: @object.active?, default_space_guid: @object.default_space_guid } end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/api/user_summary_presenter.rb
Ruby
apache-2.0
203
main
825
require_relative 'api_presenter' require_relative 'organization_presenter' class UserSummaryPresenter < ApiPresenter def entity_hash { organizations: present_orgs(@object.organizations), managed_organizations: present_orgs(@object.managed_organizations), billing_managed_organizations: present_o...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/api/job_presenter.rb
Ruby
apache-2.0
203
main
1,706
require_relative 'api_presenter' class JobPresenter < ApiPresenter def initialize(object, url_host_name=nil) super(object) @object ||= NullJob.new @url_host_name = url_host_name end protected def metadata_hash { guid: @object.guid, created_at: @object.created_at.iso8601, url...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/api/organization_presenter.rb
Ruby
apache-2.0
203
main
590
require_relative 'api_presenter' require_relative 'quota_definition_presenter' require_relative 'space_presenter' require_relative 'user_presenter' class OrganizationPresenter < ApiPresenter def entity_hash { name: @object.name, billing_enabled: @object.billing_enabled, status: @object.status, ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/api/staging_job_presenter.rb
Ruby
apache-2.0
203
main
759
require_relative 'job_presenter' class StagingJobPresenter < JobPresenter def initialize(job, scheme) @scheme = scheme super(job) end def status_url config = VCAP::CloudController::Config.config if @scheme == 'https' URI::HTTPS.build( host: config.get(:internal_service_hostname), ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/system_environment/service_instance_presenter.rb
Ruby
apache-2.0
203
main
995
class ServiceInstancePresenter def initialize(service_instance) @presenter = if service_instance.is_gateway_service ManagedPresenter.new(service_instance) else ProvidedPresenter.new(service_instance) end end delegate :to_hash, to: :@pres...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/system_environment/service_binding_presenter.rb
Ruby
apache-2.0
203
main
1,381
require 'presenters/system_environment/service_instance_presenter' class ServiceBindingPresenter WHITELISTED_VOLUME_FIELDS = %w[container_dir mode device_type].freeze def initialize(service_binding, include_instance: false) @service_binding = service_binding @include_instance = include_instance end d...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/system_environment/system_env_presenter.rb
Ruby
apache-2.0
203
main
1,398
require 'presenters/system_environment/service_instance_presenter' require 'presenters/system_environment/service_binding_presenter' class SystemEnvPresenter def initialize(app_or_process) @app_or_process = app_or_process @service_binding_k8s_enabled = app_or_process.service_binding_k8s_enabled @file_bas...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/v2/shared_domain_presenter.rb
Ruby
apache-2.0
203
main
952
module CloudController module Presenters module V2 class SharedDomainPresenter < BasePresenter extend PresenterProvider present_for_class 'VCAP::CloudController::SharedDomain' def entity_hash(controller, domain, opts, depth, parents, orphans=nil) entity = { 'n...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/v2/route_mapping_presenter.rb
Ruby
apache-2.0
203
main
816
module CloudController module Presenters module V2 class RouteMappingPresenter < BasePresenter extend PresenterProvider present_for_class 'VCAP::CloudController::RouteMappingModel' def entity_hash(controller, route_mapping, opts, depth, parents, orphans=nil) entity = { ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/v2/default_presenter.rb
Ruby
apache-2.0
203
main
662
module CloudController module Presenters module V2 class DefaultPresenter < BasePresenter def entity_hash(controller, obj, opts, depth, parents, orphans=nil) export_attrs = opts.delete(:export_attrs) if depth == 0 rel_hash = RelationsPresenter.new.to_hash(controller, obj, opts, ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/v2/service_presenter.rb
Ruby
apache-2.0
203
main
1,485
module CloudController module Presenters module V2 class ServicePresenter < BasePresenter extend PresenterProvider present_for_class 'VCAP::CloudController::Service' def entity_hash(controller, service, opts, depth, parents, orphans=nil) rel_hash = RelationsPresenter.new....
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/v2/service_instance_shared_to_presenter.rb
Ruby
apache-2.0
203
main
358
require 'presenters/v2/service_instance_shared_from_presenter' module CloudController module Presenters module V2 class ServiceInstanceSharedToPresenter < ServiceInstanceSharedFromPresenter def to_hash(space, bound_app_count) super(space).merge({ 'bound_app_count' => bound_app_count }) ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/v2/process_model_presenter.rb
Ruby
apache-2.0
203
main
3,718
require 'presenters/helpers/censorship' module CloudController module Presenters module V2 class ProcessModelPresenter < BasePresenter extend PresenterProvider present_for_class 'VCAP::CloudController::ProcessModel' def entity_hash(controller, process, opts, depth, parents, orphan...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/v2/service_instance_shared_from_presenter.rb
Ruby
apache-2.0
203
main
334
module CloudController module Presenters module V2 class ServiceInstanceSharedFromPresenter def to_hash(space) { 'space_guid' => space.guid, 'space_name' => space.name, 'organization_name' => space.organization.name } end end ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
app/presenters/v2/route_presenter.rb
Ruby
apache-2.0
203
main
1,285
module CloudController module Presenters module V2 class RoutePresenter < BasePresenter extend PresenterProvider present_for_class 'VCAP::CloudController::Route' def entity_hash(controller, obj, opts, depth, parents, orphans=nil) route = obj entity = { ...