File: environment_type.rb

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (105 lines) | stat: -rw-r--r-- 3,761 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# frozen_string_literal: true

module Types
  class EnvironmentType < BaseObject
    graphql_name 'Environment'
    description 'Describes where code is deployed for a project'

    present_using ::EnvironmentPresenter

    authorize :read_environment

    expose_permissions Types::PermissionTypes::Environment,
      description: 'Permissions for the current user on the resource. '\
        'This field can only be resolved for one environment in any single request.' do
      extension ::Gitlab::Graphql::Limit::FieldCallCount, limit: 1
    end

    field :name, GraphQL::Types::String, null: false,
      description: 'Human-readable name of the environment.'

    field :id, GraphQL::Types::ID, null: false,
      description: 'ID of the environment.'

    field :state, GraphQL::Types::String, null: false,
      description: 'State of the environment, for example: available/stopped.'

    field :path, GraphQL::Types::String, null: false,
      description: 'Path to the environment.'

    field :slug, GraphQL::Types::String,
      description: 'Slug of the environment.'

    field :external_url, GraphQL::Types::String, null: true,
      description: 'External URL of the environment.'

    field :description, GraphQL::Types::String, null: true,
      description: 'Description of the environment.'

    field :kubernetes_namespace, GraphQL::Types::String, null: true,
      description: 'Kubernetes namespace of the environment.'

    field :flux_resource_path, GraphQL::Types::String, null: true,
      description: 'Flux resource path of the environment.'

    field :created_at, Types::TimeType,
      description: 'When the environment was created.'

    field :updated_at, Types::TimeType,
      description: 'When the environment was updated.'

    field :auto_stop_at, Types::TimeType,
      description: 'When the environment is going to be stopped automatically.'

    field :auto_delete_at, Types::TimeType,
      description: 'When the environment is going to be deleted automatically.'

    field :tier, Types::DeploymentTierEnum,
      description: 'Deployment tier of the environment.'

    field :environment_type, GraphQL::Types::String,
      description: 'Folder name of the environment.'

    field :deployments_display_count, GraphQL::Types::String, null: true,
      description: 'Number of deployments in the environment for display. '\
        'Returns the precise number up to 999, and "999+" for counts exceeding this limit.'

    field :latest_opened_most_severe_alert,
      Types::AlertManagement::AlertType,
      null: true,
      description: 'Most severe open alert for the environment. If multiple alerts have equal severity, the most recent is returned.'

    field :deployments,
      Types::DeploymentType.connection_type,
      null: true,
      description: 'Deployments of the environment. This field can only be resolved for one environment in any single request.',
      resolver: Resolvers::DeploymentsResolver do
      extension ::Gitlab::Graphql::Limit::FieldCallCount, limit: 1
    end

    field :last_deployment,
      Types::DeploymentType,
      description: 'Last deployment of the environment.',
      resolver: Resolvers::Environments::LastDeploymentResolver

    field :deploy_freezes,
      [Types::Ci::FreezePeriodType],
      null: true,
      description: 'Deployment freeze periods of the environment.'

    field :cluster_agent,
      Types::Clusters::AgentType,
      description: 'Cluster agent of the environment.',
      null: true do
      extension ::Gitlab::Graphql::Limit::FieldCallCount, limit: 1
    end

    markdown_field :description_html, null: true

    def tier
      object.tier.to_sym
    end
  end
end

Types::EnvironmentType.prepend_mod_with('Types::EnvironmentType')