Commit af318c1b authored by Vitali Tatarintev's avatar Vitali Tatarintev

Add IncidentManagementOncallSchedule GraphQL type

Describe a new type for IncidentManagement::OncallSchedule
parent 1405470c
......@@ -10134,6 +10134,66 @@ An ISO 8601-encoded date
"""
scalar ISO8601Date
"""
Describes an incident management on-call schedule
"""
type IncidentManagementOncallSchedule {
"""
Description of the on-call schedule
"""
description: String
"""
Internal ID of the on-call schedule
"""
iid: ID!
"""
Name of the on-call schedule
"""
name: String!
"""
Time zone of the on-call schedule
"""
timezone: String!
}
"""
The connection type for IncidentManagementOncallSchedule.
"""
type IncidentManagementOncallScheduleConnection {
"""
A list of edges.
"""
edges: [IncidentManagementOncallScheduleEdge]
"""
A list of nodes.
"""
nodes: [IncidentManagementOncallSchedule]
"""
Information to aid in pagination.
"""
pageInfo: PageInfo!
}
"""
An edge in a connection.
"""
type IncidentManagementOncallScheduleEdge {
"""
A cursor for use in pagination.
"""
cursor: String!
"""
The item at the end of the edge.
"""
node: IncidentManagementOncallSchedule
}
type InstanceSecurityDashboard {
"""
Projects selected in Instance Security Dashboard
......@@ -15537,6 +15597,31 @@ type Project {
"""
importStatus: String
"""
Incident Management On-call schedules of the project
"""
incidentManagementOncallSchedules(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String
"""
Returns the elements in the list that come before the specified cursor.
"""
before: String
"""
Returns the first _n_ elements from the list.
"""
first: Int
"""
Returns the last _n_ elements from the list.
"""
last: Int
): IncidentManagementOncallScheduleConnection
"""
A single issue of the project
"""
......
......@@ -27740,6 +27740,199 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "IncidentManagementOncallSchedule",
"description": "Describes an incident management on-call schedule",
"fields": [
{
"name": "description",
"description": "Description of the on-call schedule",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "iid",
"description": "Internal ID of the on-call schedule",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "name",
"description": "Name of the on-call schedule",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "timezone",
"description": "Time zone of the on-call schedule",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [
],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "IncidentManagementOncallScheduleConnection",
"description": "The connection type for IncidentManagementOncallSchedule.",
"fields": [
{
"name": "edges",
"description": "A list of edges.",
"args": [
],
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "IncidentManagementOncallScheduleEdge",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "nodes",
"description": "A list of nodes.",
"args": [
],
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "IncidentManagementOncallSchedule",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "pageInfo",
"description": "Information to aid in pagination.",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "PageInfo",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [
],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "IncidentManagementOncallScheduleEdge",
"description": "An edge in a connection.",
"fields": [
{
"name": "cursor",
"description": "A cursor for use in pagination.",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "node",
"description": "The item at the end of the edge.",
"args": [
],
"type": {
"kind": "OBJECT",
"name": "IncidentManagementOncallSchedule",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [
],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "InstanceSecurityDashboard",
......@@ -45737,6 +45930,59 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "incidentManagementOncallSchedules",
"description": "Incident Management On-call schedules of the project",
"args": [
{
"name": "after",
"description": "Returns the elements in the list that come after the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "before",
"description": "Returns the elements in the list that come before the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "first",
"description": "Returns the first _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
},
{
"name": "last",
"description": "Returns the last _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
}
],
"type": {
"kind": "OBJECT",
"name": "IncidentManagementOncallScheduleConnection",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "issue",
"description": "A single issue of the project",
......@@ -1563,6 +1563,17 @@ Autogenerated return type of HttpIntegrationUpdate.
| `errors` | String! => Array | Errors encountered during execution of the mutation. |
| `integration` | AlertManagementHttpIntegration | The HTTP integration |
### IncidentManagementOncallSchedule
Describes an incident management on-call schedule.
| Field | Type | Description |
| ----- | ---- | ----------- |
| `description` | String | Description of the on-call schedule |
| `iid` | ID! | Internal ID of the on-call schedule |
| `name` | String! | Name of the on-call schedule |
| `timezone` | String! | Time zone of the on-call schedule |
### InstanceSecurityDashboard
| Field | Type | Description |
......@@ -2351,6 +2362,7 @@ Autogenerated return type of PipelineRetry.
| `httpUrlToRepo` | String | URL to connect to the project via HTTPS |
| `id` | ID! | ID of the project |
| `importStatus` | String | Status of import background job of the project |
| `incidentManagementOncallSchedules` | IncidentManagementOncallScheduleConnection | Incident Management On-call schedules of the project |
| `issue` | Issue | A single issue of the project |
| `issueStatusCounts` | IssueStatusCountsType | Counts of issues by status for the project |
| `issues` | IssueConnection | Issues of the project |
......
......@@ -148,6 +148,11 @@ module EE
description: 'Code coverage summary associated with the project',
resolver: ::Resolvers::Ci::CodeCoverageSummaryResolver
field :incident_management_oncall_schedules,
::Types::IncidentManagement::OncallScheduleType.connection_type,
null: true,
description: 'Incident Management On-call schedules of the project'
def self.sast_ci_configuration(project)
::Security::CiConfiguration::SastParserService.new(project).configuration
end
......
# frozen_string_literal: true
module Types
module IncidentManagement
class OncallScheduleType < BaseObject
graphql_name 'IncidentManagementOncallSchedule'
description 'Describes an incident management on-call schedule'
authorize :read_incident_management_oncall_schedule
field :iid,
GraphQL::ID_TYPE,
null: false,
description: 'Internal ID of the on-call schedule'
field :name,
GraphQL::STRING_TYPE,
null: false,
description: 'Name of the on-call schedule'
field :description,
GraphQL::STRING_TYPE,
null: true,
description: 'Description of the on-call schedule'
field :timezone,
GraphQL::STRING_TYPE,
null: false,
description: 'Time zone of the on-call schedule'
end
end
end
......@@ -241,6 +241,7 @@ module EE
enable :modify_auto_fix_setting
enable :modify_merge_request_author_setting
enable :modify_merge_request_committer_setting
enable :read_incident_management_oncall_schedule
end
rule { license_scanning_enabled & can?(:maintainer_access) }.enable :admin_software_license_policy
......
# frozen_string_literal: true
module IncidentManagement
class OncallSchedulePolicy < ::BasePolicy
delegate { @subject.project }
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe GitlabSchema.types['IncidentManagementOncallSchedule'] do
specify { expect(described_class.graphql_name).to eq('IncidentManagementOncallSchedule') }
specify { expect(described_class).to require_graphql_authorizations(:read_incident_management_oncall_schedule) }
it 'exposes the expected fields' do
expected_fields = %i[
iid
name
description
timezone
]
expect(described_class).to have_graphql_fields(*expected_fields)
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe IncidentManagement::OncallSchedulePolicy do
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) }
let_it_be(:oncall_schedule) { create(:incident_management_oncall_schedule, project: project) }
subject(:policy) { described_class.new(user, oncall_schedule) }
describe 'rules' do
it { is_expected.to be_disallowed :read_incident_management_oncall_schedule }
context 'when maintainer' do
before do
project.add_maintainer(user)
end
it { is_expected.to be_allowed :read_incident_management_oncall_schedule }
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment