diff --git a/pkg/github/enterprises/item_copilot_billing_request_builder.go b/pkg/github/enterprises/item_copilot_billing_request_builder.go new file mode 100644 index 00000000..3d4ee8be --- /dev/null +++ b/pkg/github/enterprises/item_copilot_billing_request_builder.go @@ -0,0 +1,28 @@ +package enterprises + +import ( + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" +) + +// ItemCopilotBillingRequestBuilder builds and executes requests for operations under \enterprises\{enterprise}\copilot\billing +type ItemCopilotBillingRequestBuilder struct { + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder +} +// NewItemCopilotBillingRequestBuilderInternal instantiates a new ItemCopilotBillingRequestBuilder and sets the default values. +func NewItemCopilotBillingRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCopilotBillingRequestBuilder) { + m := &ItemCopilotBillingRequestBuilder{ + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/enterprises/{enterprise}/copilot/billing", pathParameters), + } + return m +} +// NewItemCopilotBillingRequestBuilder instantiates a new ItemCopilotBillingRequestBuilder and sets the default values. +func NewItemCopilotBillingRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCopilotBillingRequestBuilder) { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemCopilotBillingRequestBuilderInternal(urlParams, requestAdapter) +} +// Seats the seats property +// returns a *ItemCopilotBillingSeatsRequestBuilder when successful +func (m *ItemCopilotBillingRequestBuilder) Seats()(*ItemCopilotBillingSeatsRequestBuilder) { + return NewItemCopilotBillingSeatsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) +} diff --git a/pkg/github/enterprises/item_copilot_billing_seats_get_response.go b/pkg/github/enterprises/item_copilot_billing_seats_get_response.go new file mode 100644 index 00000000..d960303c --- /dev/null +++ b/pkg/github/enterprises/item_copilot_billing_seats_get_response.go @@ -0,0 +1,122 @@ +package enterprises + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6 "github.com/octokit/go-sdk/pkg/github/models" +) + +type ItemCopilotBillingSeatsGetResponse struct { + // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additionalData map[string]any + // The seats property + seats []i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotSeatDetailsable + // Total number of Copilot seats for the organization currently being billed. + total_seats *int32 +} +// NewItemCopilotBillingSeatsGetResponse instantiates a new ItemCopilotBillingSeatsGetResponse and sets the default values. +func NewItemCopilotBillingSeatsGetResponse()(*ItemCopilotBillingSeatsGetResponse) { + m := &ItemCopilotBillingSeatsGetResponse{ + } + m.SetAdditionalData(make(map[string]any)) + return m +} +// CreateItemCopilotBillingSeatsGetResponseFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +// returns a Parsable when successful +func CreateItemCopilotBillingSeatsGetResponseFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewItemCopilotBillingSeatsGetResponse(), nil +} +// GetAdditionalData gets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +// returns a map[string]any when successful +func (m *ItemCopilotBillingSeatsGetResponse) GetAdditionalData()(map[string]any) { + return m.additionalData +} +// GetFieldDeserializers the deserialization information for the current model +// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful +func (m *ItemCopilotBillingSeatsGetResponse) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) + res["seats"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateCopilotSeatDetailsFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotSeatDetailsable, len(val)) + for i, v := range val { + if v != nil { + res[i] = v.(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotSeatDetailsable) + } + } + m.SetSeats(res) + } + return nil + } + res["total_seats"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetTotalSeats(val) + } + return nil + } + return res +} +// GetSeats gets the seats property value. The seats property +// returns a []CopilotSeatDetailsable when successful +func (m *ItemCopilotBillingSeatsGetResponse) GetSeats()([]i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotSeatDetailsable) { + return m.seats +} +// GetTotalSeats gets the total_seats property value. Total number of Copilot seats for the organization currently being billed. +// returns a *int32 when successful +func (m *ItemCopilotBillingSeatsGetResponse) GetTotalSeats()(*int32) { + return m.total_seats +} +// Serialize serializes information the current object +func (m *ItemCopilotBillingSeatsGetResponse) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + if m.GetSeats() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetSeats())) + for i, v := range m.GetSeats() { + if v != nil { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + } + err := writer.WriteCollectionOfObjectValues("seats", cast) + if err != nil { + return err + } + } + { + err := writer.WriteInt32Value("total_seats", m.GetTotalSeats()) + if err != nil { + return err + } + } + { + err := writer.WriteAdditionalData(m.GetAdditionalData()) + if err != nil { + return err + } + } + return nil +} +// SetAdditionalData sets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *ItemCopilotBillingSeatsGetResponse) SetAdditionalData(value map[string]any)() { + m.additionalData = value +} +// SetSeats sets the seats property value. The seats property +func (m *ItemCopilotBillingSeatsGetResponse) SetSeats(value []i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotSeatDetailsable)() { + m.seats = value +} +// SetTotalSeats sets the total_seats property value. Total number of Copilot seats for the organization currently being billed. +func (m *ItemCopilotBillingSeatsGetResponse) SetTotalSeats(value *int32)() { + m.total_seats = value +} +type ItemCopilotBillingSeatsGetResponseable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetSeats()([]i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotSeatDetailsable) + GetTotalSeats()(*int32) + SetSeats(value []i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotSeatDetailsable)() + SetTotalSeats(value *int32)() +} diff --git a/pkg/github/enterprises/item_copilot_billing_seats_request_builder.go b/pkg/github/enterprises/item_copilot_billing_seats_request_builder.go new file mode 100644 index 00000000..c65f61c7 --- /dev/null +++ b/pkg/github/enterprises/item_copilot_billing_seats_request_builder.go @@ -0,0 +1,74 @@ +package enterprises + +import ( + "context" + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6 "github.com/octokit/go-sdk/pkg/github/models" +) + +// ItemCopilotBillingSeatsRequestBuilder builds and executes requests for operations under \enterprises\{enterprise}\copilot\billing\seats +type ItemCopilotBillingSeatsRequestBuilder struct { + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder +} +// ItemCopilotBillingSeatsRequestBuilderGetQueryParameters **Note**: This endpoint is in beta and is subject to change.Lists all active Copilot seats across organizations or enterprise teams for an enterprise with a Copilot Business or Copilot Enterprise subscription.Only enterprise owners and billing managers can view assigned Copilot seats across their child organizations or enterprise teams.Personal access tokens (classic) need either the `manage_billing:copilot` or `read:enterprise` scopes to use this endpoint. +type ItemCopilotBillingSeatsRequestBuilderGetQueryParameters struct { + // The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." + Page *int32 `uriparametername:"page"` + // The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." + Per_page *int32 `uriparametername:"per_page"` +} +// NewItemCopilotBillingSeatsRequestBuilderInternal instantiates a new ItemCopilotBillingSeatsRequestBuilder and sets the default values. +func NewItemCopilotBillingSeatsRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCopilotBillingSeatsRequestBuilder) { + m := &ItemCopilotBillingSeatsRequestBuilder{ + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/enterprises/{enterprise}/copilot/billing/seats{?page*,per_page*}", pathParameters), + } + return m +} +// NewItemCopilotBillingSeatsRequestBuilder instantiates a new ItemCopilotBillingSeatsRequestBuilder and sets the default values. +func NewItemCopilotBillingSeatsRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCopilotBillingSeatsRequestBuilder) { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemCopilotBillingSeatsRequestBuilderInternal(urlParams, requestAdapter) +} +// Get **Note**: This endpoint is in beta and is subject to change.Lists all active Copilot seats across organizations or enterprise teams for an enterprise with a Copilot Business or Copilot Enterprise subscription.Only enterprise owners and billing managers can view assigned Copilot seats across their child organizations or enterprise teams.Personal access tokens (classic) need either the `manage_billing:copilot` or `read:enterprise` scopes to use this endpoint. +// returns a ItemCopilotBillingSeatsGetResponseable when successful +// returns a BasicError error when the service returns a 401 status code +// returns a BasicError error when the service returns a 403 status code +// returns a BasicError error when the service returns a 404 status code +// returns a BasicError error when the service returns a 500 status code +// [API method documentation] +// +// [API method documentation]: https://docs.github.com/rest/copilot/copilot-user-management#list-all-copilot-seat-assignments-for-an-enterprise +func (m *ItemCopilotBillingSeatsRequestBuilder) Get(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[ItemCopilotBillingSeatsRequestBuilderGetQueryParameters])(ItemCopilotBillingSeatsGetResponseable, error) { + requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration); + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings { + "401": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "403": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "404": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "500": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + } + res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, CreateItemCopilotBillingSeatsGetResponseFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ItemCopilotBillingSeatsGetResponseable), nil +} +// ToGetRequestInformation **Note**: This endpoint is in beta and is subject to change.Lists all active Copilot seats across organizations or enterprise teams for an enterprise with a Copilot Business or Copilot Enterprise subscription.Only enterprise owners and billing managers can view assigned Copilot seats across their child organizations or enterprise teams.Personal access tokens (classic) need either the `manage_billing:copilot` or `read:enterprise` scopes to use this endpoint. +// returns a *RequestInformation when successful +func (m *ItemCopilotBillingSeatsRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[ItemCopilotBillingSeatsRequestBuilderGetQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ConfigureRequestInformation(requestInfo, requestConfiguration) + requestInfo.Headers.TryAdd("Accept", "application/json") + return requestInfo, nil +} +// WithUrl returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. +// returns a *ItemCopilotBillingSeatsRequestBuilder when successful +func (m *ItemCopilotBillingSeatsRequestBuilder) WithUrl(rawUrl string)(*ItemCopilotBillingSeatsRequestBuilder) { + return NewItemCopilotBillingSeatsRequestBuilder(rawUrl, m.BaseRequestBuilder.RequestAdapter); +} diff --git a/pkg/github/enterprises/item_copilot_request_builder.go b/pkg/github/enterprises/item_copilot_request_builder.go index f53b9942..9a7c8b1e 100644 --- a/pkg/github/enterprises/item_copilot_request_builder.go +++ b/pkg/github/enterprises/item_copilot_request_builder.go @@ -8,6 +8,11 @@ import ( type ItemCopilotRequestBuilder struct { i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder } +// Billing the billing property +// returns a *ItemCopilotBillingRequestBuilder when successful +func (m *ItemCopilotRequestBuilder) Billing()(*ItemCopilotBillingRequestBuilder) { + return NewItemCopilotBillingRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) +} // NewItemCopilotRequestBuilderInternal instantiates a new ItemCopilotRequestBuilder and sets the default values. func NewItemCopilotRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCopilotRequestBuilder) { m := &ItemCopilotRequestBuilder{ diff --git a/pkg/github/kiota-lock.json b/pkg/github/kiota-lock.json index 6e87846c..843bf8bc 100644 --- a/pkg/github/kiota-lock.json +++ b/pkg/github/kiota-lock.json @@ -1,5 +1,5 @@ { - "descriptionHash": "CC651E4ACEA89E310D94E680A9C5DA642585F6E64A62690EF521FEC32645CFF020BE50EDD35878C18D66BD61A8E735804C69FA02094A6F459E02BBFC1AF46C6E", + "descriptionHash": "524B7995C3F724FBD5311CE721AFE148291ACD56B5B0A77B7A38BD87C4ABB7861406A0A812CBC457F589E9F17D1493533C0EDCA1A7CC6A587DADAB2A2E2BF9DE", "descriptionLocation": "../../../../schemas/downloaded.json", "lockFileVersion": "1.0.0", "kiotaVersion": "1.14.0", diff --git a/pkg/github/models/code_security_configuration.go b/pkg/github/models/code_security_configuration.go new file mode 100644 index 00000000..12ef440d --- /dev/null +++ b/pkg/github/models/code_security_configuration.go @@ -0,0 +1,526 @@ +package models + +import ( + i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time" + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// CodeSecurityConfiguration a code security configuration +type CodeSecurityConfiguration struct { + // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additionalData map[string]any + // The enablement status of GitHub Advanced Security + advanced_security *CodeSecurityConfiguration_advanced_security + // The enablement status of code scanning default setup + code_scanning_default_setup *CodeSecurityConfiguration_code_scanning_default_setup + // The created_at property + created_at *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time + // The enablement status of Dependabot alerts + dependabot_alerts *CodeSecurityConfiguration_dependabot_alerts + // The enablement status of Dependabot security updates + dependabot_security_updates *CodeSecurityConfiguration_dependabot_security_updates + // The enablement status of Dependency Graph + dependency_graph *CodeSecurityConfiguration_dependency_graph + // A description of the code security configuration + description *string + // The URL of the configuration + html_url *string + // The ID of the code security configuration + id *int32 + // The name of the code security configuration. Must be unique within the organization. + name *string + // The enablement status of private vulnerability reporting + private_vulnerability_reporting *CodeSecurityConfiguration_private_vulnerability_reporting + // The enablement status of secret scanning + secret_scanning *CodeSecurityConfiguration_secret_scanning + // The enablement status of secret scanning push protection + secret_scanning_push_protection *CodeSecurityConfiguration_secret_scanning_push_protection + // The type of the code security configuration. + target_type *CodeSecurityConfiguration_target_type + // The updated_at property + updated_at *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time + // The URL of the configuration + url *string +} +// NewCodeSecurityConfiguration instantiates a new CodeSecurityConfiguration and sets the default values. +func NewCodeSecurityConfiguration()(*CodeSecurityConfiguration) { + m := &CodeSecurityConfiguration{ + } + m.SetAdditionalData(make(map[string]any)) + return m +} +// CreateCodeSecurityConfigurationFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +// returns a Parsable when successful +func CreateCodeSecurityConfigurationFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewCodeSecurityConfiguration(), nil +} +// GetAdditionalData gets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +// returns a map[string]any when successful +func (m *CodeSecurityConfiguration) GetAdditionalData()(map[string]any) { + return m.additionalData +} +// GetAdvancedSecurity gets the advanced_security property value. The enablement status of GitHub Advanced Security +// returns a *CodeSecurityConfiguration_advanced_security when successful +func (m *CodeSecurityConfiguration) GetAdvancedSecurity()(*CodeSecurityConfiguration_advanced_security) { + return m.advanced_security +} +// GetCodeScanningDefaultSetup gets the code_scanning_default_setup property value. The enablement status of code scanning default setup +// returns a *CodeSecurityConfiguration_code_scanning_default_setup when successful +func (m *CodeSecurityConfiguration) GetCodeScanningDefaultSetup()(*CodeSecurityConfiguration_code_scanning_default_setup) { + return m.code_scanning_default_setup +} +// GetCreatedAt gets the created_at property value. The created_at property +// returns a *Time when successful +func (m *CodeSecurityConfiguration) GetCreatedAt()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) { + return m.created_at +} +// GetDependabotAlerts gets the dependabot_alerts property value. The enablement status of Dependabot alerts +// returns a *CodeSecurityConfiguration_dependabot_alerts when successful +func (m *CodeSecurityConfiguration) GetDependabotAlerts()(*CodeSecurityConfiguration_dependabot_alerts) { + return m.dependabot_alerts +} +// GetDependabotSecurityUpdates gets the dependabot_security_updates property value. The enablement status of Dependabot security updates +// returns a *CodeSecurityConfiguration_dependabot_security_updates when successful +func (m *CodeSecurityConfiguration) GetDependabotSecurityUpdates()(*CodeSecurityConfiguration_dependabot_security_updates) { + return m.dependabot_security_updates +} +// GetDependencyGraph gets the dependency_graph property value. The enablement status of Dependency Graph +// returns a *CodeSecurityConfiguration_dependency_graph when successful +func (m *CodeSecurityConfiguration) GetDependencyGraph()(*CodeSecurityConfiguration_dependency_graph) { + return m.dependency_graph +} +// GetDescription gets the description property value. A description of the code security configuration +// returns a *string when successful +func (m *CodeSecurityConfiguration) GetDescription()(*string) { + return m.description +} +// GetFieldDeserializers the deserialization information for the current model +// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful +func (m *CodeSecurityConfiguration) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) + res["advanced_security"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetEnumValue(ParseCodeSecurityConfiguration_advanced_security) + if err != nil { + return err + } + if val != nil { + m.SetAdvancedSecurity(val.(*CodeSecurityConfiguration_advanced_security)) + } + return nil + } + res["code_scanning_default_setup"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetEnumValue(ParseCodeSecurityConfiguration_code_scanning_default_setup) + if err != nil { + return err + } + if val != nil { + m.SetCodeScanningDefaultSetup(val.(*CodeSecurityConfiguration_code_scanning_default_setup)) + } + return nil + } + res["created_at"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetTimeValue() + if err != nil { + return err + } + if val != nil { + m.SetCreatedAt(val) + } + return nil + } + res["dependabot_alerts"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetEnumValue(ParseCodeSecurityConfiguration_dependabot_alerts) + if err != nil { + return err + } + if val != nil { + m.SetDependabotAlerts(val.(*CodeSecurityConfiguration_dependabot_alerts)) + } + return nil + } + res["dependabot_security_updates"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetEnumValue(ParseCodeSecurityConfiguration_dependabot_security_updates) + if err != nil { + return err + } + if val != nil { + m.SetDependabotSecurityUpdates(val.(*CodeSecurityConfiguration_dependabot_security_updates)) + } + return nil + } + res["dependency_graph"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetEnumValue(ParseCodeSecurityConfiguration_dependency_graph) + if err != nil { + return err + } + if val != nil { + m.SetDependencyGraph(val.(*CodeSecurityConfiguration_dependency_graph)) + } + return nil + } + res["description"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetDescription(val) + } + return nil + } + res["html_url"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetHtmlUrl(val) + } + return nil + } + res["id"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetId(val) + } + return nil + } + res["name"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetName(val) + } + return nil + } + res["private_vulnerability_reporting"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetEnumValue(ParseCodeSecurityConfiguration_private_vulnerability_reporting) + if err != nil { + return err + } + if val != nil { + m.SetPrivateVulnerabilityReporting(val.(*CodeSecurityConfiguration_private_vulnerability_reporting)) + } + return nil + } + res["secret_scanning"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetEnumValue(ParseCodeSecurityConfiguration_secret_scanning) + if err != nil { + return err + } + if val != nil { + m.SetSecretScanning(val.(*CodeSecurityConfiguration_secret_scanning)) + } + return nil + } + res["secret_scanning_push_protection"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetEnumValue(ParseCodeSecurityConfiguration_secret_scanning_push_protection) + if err != nil { + return err + } + if val != nil { + m.SetSecretScanningPushProtection(val.(*CodeSecurityConfiguration_secret_scanning_push_protection)) + } + return nil + } + res["target_type"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetEnumValue(ParseCodeSecurityConfiguration_target_type) + if err != nil { + return err + } + if val != nil { + m.SetTargetType(val.(*CodeSecurityConfiguration_target_type)) + } + return nil + } + res["updated_at"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetTimeValue() + if err != nil { + return err + } + if val != nil { + m.SetUpdatedAt(val) + } + return nil + } + res["url"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetUrl(val) + } + return nil + } + return res +} +// GetHtmlUrl gets the html_url property value. The URL of the configuration +// returns a *string when successful +func (m *CodeSecurityConfiguration) GetHtmlUrl()(*string) { + return m.html_url +} +// GetId gets the id property value. The ID of the code security configuration +// returns a *int32 when successful +func (m *CodeSecurityConfiguration) GetId()(*int32) { + return m.id +} +// GetName gets the name property value. The name of the code security configuration. Must be unique within the organization. +// returns a *string when successful +func (m *CodeSecurityConfiguration) GetName()(*string) { + return m.name +} +// GetPrivateVulnerabilityReporting gets the private_vulnerability_reporting property value. The enablement status of private vulnerability reporting +// returns a *CodeSecurityConfiguration_private_vulnerability_reporting when successful +func (m *CodeSecurityConfiguration) GetPrivateVulnerabilityReporting()(*CodeSecurityConfiguration_private_vulnerability_reporting) { + return m.private_vulnerability_reporting +} +// GetSecretScanning gets the secret_scanning property value. The enablement status of secret scanning +// returns a *CodeSecurityConfiguration_secret_scanning when successful +func (m *CodeSecurityConfiguration) GetSecretScanning()(*CodeSecurityConfiguration_secret_scanning) { + return m.secret_scanning +} +// GetSecretScanningPushProtection gets the secret_scanning_push_protection property value. The enablement status of secret scanning push protection +// returns a *CodeSecurityConfiguration_secret_scanning_push_protection when successful +func (m *CodeSecurityConfiguration) GetSecretScanningPushProtection()(*CodeSecurityConfiguration_secret_scanning_push_protection) { + return m.secret_scanning_push_protection +} +// GetTargetType gets the target_type property value. The type of the code security configuration. +// returns a *CodeSecurityConfiguration_target_type when successful +func (m *CodeSecurityConfiguration) GetTargetType()(*CodeSecurityConfiguration_target_type) { + return m.target_type +} +// GetUpdatedAt gets the updated_at property value. The updated_at property +// returns a *Time when successful +func (m *CodeSecurityConfiguration) GetUpdatedAt()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) { + return m.updated_at +} +// GetUrl gets the url property value. The URL of the configuration +// returns a *string when successful +func (m *CodeSecurityConfiguration) GetUrl()(*string) { + return m.url +} +// Serialize serializes information the current object +func (m *CodeSecurityConfiguration) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + if m.GetAdvancedSecurity() != nil { + cast := (*m.GetAdvancedSecurity()).String() + err := writer.WriteStringValue("advanced_security", &cast) + if err != nil { + return err + } + } + if m.GetCodeScanningDefaultSetup() != nil { + cast := (*m.GetCodeScanningDefaultSetup()).String() + err := writer.WriteStringValue("code_scanning_default_setup", &cast) + if err != nil { + return err + } + } + { + err := writer.WriteTimeValue("created_at", m.GetCreatedAt()) + if err != nil { + return err + } + } + if m.GetDependabotAlerts() != nil { + cast := (*m.GetDependabotAlerts()).String() + err := writer.WriteStringValue("dependabot_alerts", &cast) + if err != nil { + return err + } + } + if m.GetDependabotSecurityUpdates() != nil { + cast := (*m.GetDependabotSecurityUpdates()).String() + err := writer.WriteStringValue("dependabot_security_updates", &cast) + if err != nil { + return err + } + } + if m.GetDependencyGraph() != nil { + cast := (*m.GetDependencyGraph()).String() + err := writer.WriteStringValue("dependency_graph", &cast) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("description", m.GetDescription()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("html_url", m.GetHtmlUrl()) + if err != nil { + return err + } + } + { + err := writer.WriteInt32Value("id", m.GetId()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("name", m.GetName()) + if err != nil { + return err + } + } + if m.GetPrivateVulnerabilityReporting() != nil { + cast := (*m.GetPrivateVulnerabilityReporting()).String() + err := writer.WriteStringValue("private_vulnerability_reporting", &cast) + if err != nil { + return err + } + } + if m.GetSecretScanning() != nil { + cast := (*m.GetSecretScanning()).String() + err := writer.WriteStringValue("secret_scanning", &cast) + if err != nil { + return err + } + } + if m.GetSecretScanningPushProtection() != nil { + cast := (*m.GetSecretScanningPushProtection()).String() + err := writer.WriteStringValue("secret_scanning_push_protection", &cast) + if err != nil { + return err + } + } + if m.GetTargetType() != nil { + cast := (*m.GetTargetType()).String() + err := writer.WriteStringValue("target_type", &cast) + if err != nil { + return err + } + } + { + err := writer.WriteTimeValue("updated_at", m.GetUpdatedAt()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("url", m.GetUrl()) + if err != nil { + return err + } + } + { + err := writer.WriteAdditionalData(m.GetAdditionalData()) + if err != nil { + return err + } + } + return nil +} +// SetAdditionalData sets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *CodeSecurityConfiguration) SetAdditionalData(value map[string]any)() { + m.additionalData = value +} +// SetAdvancedSecurity sets the advanced_security property value. The enablement status of GitHub Advanced Security +func (m *CodeSecurityConfiguration) SetAdvancedSecurity(value *CodeSecurityConfiguration_advanced_security)() { + m.advanced_security = value +} +// SetCodeScanningDefaultSetup sets the code_scanning_default_setup property value. The enablement status of code scanning default setup +func (m *CodeSecurityConfiguration) SetCodeScanningDefaultSetup(value *CodeSecurityConfiguration_code_scanning_default_setup)() { + m.code_scanning_default_setup = value +} +// SetCreatedAt sets the created_at property value. The created_at property +func (m *CodeSecurityConfiguration) SetCreatedAt(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() { + m.created_at = value +} +// SetDependabotAlerts sets the dependabot_alerts property value. The enablement status of Dependabot alerts +func (m *CodeSecurityConfiguration) SetDependabotAlerts(value *CodeSecurityConfiguration_dependabot_alerts)() { + m.dependabot_alerts = value +} +// SetDependabotSecurityUpdates sets the dependabot_security_updates property value. The enablement status of Dependabot security updates +func (m *CodeSecurityConfiguration) SetDependabotSecurityUpdates(value *CodeSecurityConfiguration_dependabot_security_updates)() { + m.dependabot_security_updates = value +} +// SetDependencyGraph sets the dependency_graph property value. The enablement status of Dependency Graph +func (m *CodeSecurityConfiguration) SetDependencyGraph(value *CodeSecurityConfiguration_dependency_graph)() { + m.dependency_graph = value +} +// SetDescription sets the description property value. A description of the code security configuration +func (m *CodeSecurityConfiguration) SetDescription(value *string)() { + m.description = value +} +// SetHtmlUrl sets the html_url property value. The URL of the configuration +func (m *CodeSecurityConfiguration) SetHtmlUrl(value *string)() { + m.html_url = value +} +// SetId sets the id property value. The ID of the code security configuration +func (m *CodeSecurityConfiguration) SetId(value *int32)() { + m.id = value +} +// SetName sets the name property value. The name of the code security configuration. Must be unique within the organization. +func (m *CodeSecurityConfiguration) SetName(value *string)() { + m.name = value +} +// SetPrivateVulnerabilityReporting sets the private_vulnerability_reporting property value. The enablement status of private vulnerability reporting +func (m *CodeSecurityConfiguration) SetPrivateVulnerabilityReporting(value *CodeSecurityConfiguration_private_vulnerability_reporting)() { + m.private_vulnerability_reporting = value +} +// SetSecretScanning sets the secret_scanning property value. The enablement status of secret scanning +func (m *CodeSecurityConfiguration) SetSecretScanning(value *CodeSecurityConfiguration_secret_scanning)() { + m.secret_scanning = value +} +// SetSecretScanningPushProtection sets the secret_scanning_push_protection property value. The enablement status of secret scanning push protection +func (m *CodeSecurityConfiguration) SetSecretScanningPushProtection(value *CodeSecurityConfiguration_secret_scanning_push_protection)() { + m.secret_scanning_push_protection = value +} +// SetTargetType sets the target_type property value. The type of the code security configuration. +func (m *CodeSecurityConfiguration) SetTargetType(value *CodeSecurityConfiguration_target_type)() { + m.target_type = value +} +// SetUpdatedAt sets the updated_at property value. The updated_at property +func (m *CodeSecurityConfiguration) SetUpdatedAt(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() { + m.updated_at = value +} +// SetUrl sets the url property value. The URL of the configuration +func (m *CodeSecurityConfiguration) SetUrl(value *string)() { + m.url = value +} +type CodeSecurityConfigurationable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetAdvancedSecurity()(*CodeSecurityConfiguration_advanced_security) + GetCodeScanningDefaultSetup()(*CodeSecurityConfiguration_code_scanning_default_setup) + GetCreatedAt()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) + GetDependabotAlerts()(*CodeSecurityConfiguration_dependabot_alerts) + GetDependabotSecurityUpdates()(*CodeSecurityConfiguration_dependabot_security_updates) + GetDependencyGraph()(*CodeSecurityConfiguration_dependency_graph) + GetDescription()(*string) + GetHtmlUrl()(*string) + GetId()(*int32) + GetName()(*string) + GetPrivateVulnerabilityReporting()(*CodeSecurityConfiguration_private_vulnerability_reporting) + GetSecretScanning()(*CodeSecurityConfiguration_secret_scanning) + GetSecretScanningPushProtection()(*CodeSecurityConfiguration_secret_scanning_push_protection) + GetTargetType()(*CodeSecurityConfiguration_target_type) + GetUpdatedAt()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) + GetUrl()(*string) + SetAdvancedSecurity(value *CodeSecurityConfiguration_advanced_security)() + SetCodeScanningDefaultSetup(value *CodeSecurityConfiguration_code_scanning_default_setup)() + SetCreatedAt(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() + SetDependabotAlerts(value *CodeSecurityConfiguration_dependabot_alerts)() + SetDependabotSecurityUpdates(value *CodeSecurityConfiguration_dependabot_security_updates)() + SetDependencyGraph(value *CodeSecurityConfiguration_dependency_graph)() + SetDescription(value *string)() + SetHtmlUrl(value *string)() + SetId(value *int32)() + SetName(value *string)() + SetPrivateVulnerabilityReporting(value *CodeSecurityConfiguration_private_vulnerability_reporting)() + SetSecretScanning(value *CodeSecurityConfiguration_secret_scanning)() + SetSecretScanningPushProtection(value *CodeSecurityConfiguration_secret_scanning_push_protection)() + SetTargetType(value *CodeSecurityConfiguration_target_type)() + SetUpdatedAt(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() + SetUrl(value *string)() +} diff --git a/pkg/github/models/code_security_configuration_advanced_security.go b/pkg/github/models/code_security_configuration_advanced_security.go new file mode 100644 index 00000000..ddc2cfac --- /dev/null +++ b/pkg/github/models/code_security_configuration_advanced_security.go @@ -0,0 +1,37 @@ +package models +import ( + "errors" +) +// The enablement status of GitHub Advanced Security +type CodeSecurityConfiguration_advanced_security int + +const ( + ENABLED_CODESECURITYCONFIGURATION_ADVANCED_SECURITY CodeSecurityConfiguration_advanced_security = iota + DISABLED_CODESECURITYCONFIGURATION_ADVANCED_SECURITY +) + +func (i CodeSecurityConfiguration_advanced_security) String() string { + return []string{"enabled", "disabled"}[i] +} +func ParseCodeSecurityConfiguration_advanced_security(v string) (any, error) { + result := ENABLED_CODESECURITYCONFIGURATION_ADVANCED_SECURITY + switch v { + case "enabled": + result = ENABLED_CODESECURITYCONFIGURATION_ADVANCED_SECURITY + case "disabled": + result = DISABLED_CODESECURITYCONFIGURATION_ADVANCED_SECURITY + default: + return 0, errors.New("Unknown CodeSecurityConfiguration_advanced_security value: " + v) + } + return &result, nil +} +func SerializeCodeSecurityConfiguration_advanced_security(values []CodeSecurityConfiguration_advanced_security) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i CodeSecurityConfiguration_advanced_security) isMultiValue() bool { + return false +} diff --git a/pkg/github/models/code_security_configuration_code_scanning_default_setup.go b/pkg/github/models/code_security_configuration_code_scanning_default_setup.go new file mode 100644 index 00000000..75fecc0b --- /dev/null +++ b/pkg/github/models/code_security_configuration_code_scanning_default_setup.go @@ -0,0 +1,40 @@ +package models +import ( + "errors" +) +// The enablement status of code scanning default setup +type CodeSecurityConfiguration_code_scanning_default_setup int + +const ( + ENABLED_CODESECURITYCONFIGURATION_CODE_SCANNING_DEFAULT_SETUP CodeSecurityConfiguration_code_scanning_default_setup = iota + DISABLED_CODESECURITYCONFIGURATION_CODE_SCANNING_DEFAULT_SETUP + NOT_SET_CODESECURITYCONFIGURATION_CODE_SCANNING_DEFAULT_SETUP +) + +func (i CodeSecurityConfiguration_code_scanning_default_setup) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseCodeSecurityConfiguration_code_scanning_default_setup(v string) (any, error) { + result := ENABLED_CODESECURITYCONFIGURATION_CODE_SCANNING_DEFAULT_SETUP + switch v { + case "enabled": + result = ENABLED_CODESECURITYCONFIGURATION_CODE_SCANNING_DEFAULT_SETUP + case "disabled": + result = DISABLED_CODESECURITYCONFIGURATION_CODE_SCANNING_DEFAULT_SETUP + case "not_set": + result = NOT_SET_CODESECURITYCONFIGURATION_CODE_SCANNING_DEFAULT_SETUP + default: + return 0, errors.New("Unknown CodeSecurityConfiguration_code_scanning_default_setup value: " + v) + } + return &result, nil +} +func SerializeCodeSecurityConfiguration_code_scanning_default_setup(values []CodeSecurityConfiguration_code_scanning_default_setup) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i CodeSecurityConfiguration_code_scanning_default_setup) isMultiValue() bool { + return false +} diff --git a/pkg/github/models/code_security_configuration_dependabot_alerts.go b/pkg/github/models/code_security_configuration_dependabot_alerts.go new file mode 100644 index 00000000..f3e1af77 --- /dev/null +++ b/pkg/github/models/code_security_configuration_dependabot_alerts.go @@ -0,0 +1,40 @@ +package models +import ( + "errors" +) +// The enablement status of Dependabot alerts +type CodeSecurityConfiguration_dependabot_alerts int + +const ( + ENABLED_CODESECURITYCONFIGURATION_DEPENDABOT_ALERTS CodeSecurityConfiguration_dependabot_alerts = iota + DISABLED_CODESECURITYCONFIGURATION_DEPENDABOT_ALERTS + NOT_SET_CODESECURITYCONFIGURATION_DEPENDABOT_ALERTS +) + +func (i CodeSecurityConfiguration_dependabot_alerts) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseCodeSecurityConfiguration_dependabot_alerts(v string) (any, error) { + result := ENABLED_CODESECURITYCONFIGURATION_DEPENDABOT_ALERTS + switch v { + case "enabled": + result = ENABLED_CODESECURITYCONFIGURATION_DEPENDABOT_ALERTS + case "disabled": + result = DISABLED_CODESECURITYCONFIGURATION_DEPENDABOT_ALERTS + case "not_set": + result = NOT_SET_CODESECURITYCONFIGURATION_DEPENDABOT_ALERTS + default: + return 0, errors.New("Unknown CodeSecurityConfiguration_dependabot_alerts value: " + v) + } + return &result, nil +} +func SerializeCodeSecurityConfiguration_dependabot_alerts(values []CodeSecurityConfiguration_dependabot_alerts) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i CodeSecurityConfiguration_dependabot_alerts) isMultiValue() bool { + return false +} diff --git a/pkg/github/models/code_security_configuration_dependabot_security_updates.go b/pkg/github/models/code_security_configuration_dependabot_security_updates.go new file mode 100644 index 00000000..eec6d4e6 --- /dev/null +++ b/pkg/github/models/code_security_configuration_dependabot_security_updates.go @@ -0,0 +1,40 @@ +package models +import ( + "errors" +) +// The enablement status of Dependabot security updates +type CodeSecurityConfiguration_dependabot_security_updates int + +const ( + ENABLED_CODESECURITYCONFIGURATION_DEPENDABOT_SECURITY_UPDATES CodeSecurityConfiguration_dependabot_security_updates = iota + DISABLED_CODESECURITYCONFIGURATION_DEPENDABOT_SECURITY_UPDATES + NOT_SET_CODESECURITYCONFIGURATION_DEPENDABOT_SECURITY_UPDATES +) + +func (i CodeSecurityConfiguration_dependabot_security_updates) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseCodeSecurityConfiguration_dependabot_security_updates(v string) (any, error) { + result := ENABLED_CODESECURITYCONFIGURATION_DEPENDABOT_SECURITY_UPDATES + switch v { + case "enabled": + result = ENABLED_CODESECURITYCONFIGURATION_DEPENDABOT_SECURITY_UPDATES + case "disabled": + result = DISABLED_CODESECURITYCONFIGURATION_DEPENDABOT_SECURITY_UPDATES + case "not_set": + result = NOT_SET_CODESECURITYCONFIGURATION_DEPENDABOT_SECURITY_UPDATES + default: + return 0, errors.New("Unknown CodeSecurityConfiguration_dependabot_security_updates value: " + v) + } + return &result, nil +} +func SerializeCodeSecurityConfiguration_dependabot_security_updates(values []CodeSecurityConfiguration_dependabot_security_updates) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i CodeSecurityConfiguration_dependabot_security_updates) isMultiValue() bool { + return false +} diff --git a/pkg/github/models/code_security_configuration_dependency_graph.go b/pkg/github/models/code_security_configuration_dependency_graph.go new file mode 100644 index 00000000..e92e1bab --- /dev/null +++ b/pkg/github/models/code_security_configuration_dependency_graph.go @@ -0,0 +1,40 @@ +package models +import ( + "errors" +) +// The enablement status of Dependency Graph +type CodeSecurityConfiguration_dependency_graph int + +const ( + ENABLED_CODESECURITYCONFIGURATION_DEPENDENCY_GRAPH CodeSecurityConfiguration_dependency_graph = iota + DISABLED_CODESECURITYCONFIGURATION_DEPENDENCY_GRAPH + NOT_SET_CODESECURITYCONFIGURATION_DEPENDENCY_GRAPH +) + +func (i CodeSecurityConfiguration_dependency_graph) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseCodeSecurityConfiguration_dependency_graph(v string) (any, error) { + result := ENABLED_CODESECURITYCONFIGURATION_DEPENDENCY_GRAPH + switch v { + case "enabled": + result = ENABLED_CODESECURITYCONFIGURATION_DEPENDENCY_GRAPH + case "disabled": + result = DISABLED_CODESECURITYCONFIGURATION_DEPENDENCY_GRAPH + case "not_set": + result = NOT_SET_CODESECURITYCONFIGURATION_DEPENDENCY_GRAPH + default: + return 0, errors.New("Unknown CodeSecurityConfiguration_dependency_graph value: " + v) + } + return &result, nil +} +func SerializeCodeSecurityConfiguration_dependency_graph(values []CodeSecurityConfiguration_dependency_graph) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i CodeSecurityConfiguration_dependency_graph) isMultiValue() bool { + return false +} diff --git a/pkg/github/models/code_security_configuration_private_vulnerability_reporting.go b/pkg/github/models/code_security_configuration_private_vulnerability_reporting.go new file mode 100644 index 00000000..7342de59 --- /dev/null +++ b/pkg/github/models/code_security_configuration_private_vulnerability_reporting.go @@ -0,0 +1,40 @@ +package models +import ( + "errors" +) +// The enablement status of private vulnerability reporting +type CodeSecurityConfiguration_private_vulnerability_reporting int + +const ( + ENABLED_CODESECURITYCONFIGURATION_PRIVATE_VULNERABILITY_REPORTING CodeSecurityConfiguration_private_vulnerability_reporting = iota + DISABLED_CODESECURITYCONFIGURATION_PRIVATE_VULNERABILITY_REPORTING + NOT_SET_CODESECURITYCONFIGURATION_PRIVATE_VULNERABILITY_REPORTING +) + +func (i CodeSecurityConfiguration_private_vulnerability_reporting) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseCodeSecurityConfiguration_private_vulnerability_reporting(v string) (any, error) { + result := ENABLED_CODESECURITYCONFIGURATION_PRIVATE_VULNERABILITY_REPORTING + switch v { + case "enabled": + result = ENABLED_CODESECURITYCONFIGURATION_PRIVATE_VULNERABILITY_REPORTING + case "disabled": + result = DISABLED_CODESECURITYCONFIGURATION_PRIVATE_VULNERABILITY_REPORTING + case "not_set": + result = NOT_SET_CODESECURITYCONFIGURATION_PRIVATE_VULNERABILITY_REPORTING + default: + return 0, errors.New("Unknown CodeSecurityConfiguration_private_vulnerability_reporting value: " + v) + } + return &result, nil +} +func SerializeCodeSecurityConfiguration_private_vulnerability_reporting(values []CodeSecurityConfiguration_private_vulnerability_reporting) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i CodeSecurityConfiguration_private_vulnerability_reporting) isMultiValue() bool { + return false +} diff --git a/pkg/github/models/code_security_configuration_repositories.go b/pkg/github/models/code_security_configuration_repositories.go new file mode 100644 index 00000000..9ed54627 --- /dev/null +++ b/pkg/github/models/code_security_configuration_repositories.go @@ -0,0 +1,111 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// CodeSecurityConfigurationRepositories repositories associated with a code security configuration and attachment status +type CodeSecurityConfigurationRepositories struct { + // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additionalData map[string]any + // A GitHub repository. + repository SimpleRepositoryable + // The attachment status of the code security configuration on the repository. + status *CodeSecurityConfigurationRepositories_status +} +// NewCodeSecurityConfigurationRepositories instantiates a new CodeSecurityConfigurationRepositories and sets the default values. +func NewCodeSecurityConfigurationRepositories()(*CodeSecurityConfigurationRepositories) { + m := &CodeSecurityConfigurationRepositories{ + } + m.SetAdditionalData(make(map[string]any)) + return m +} +// CreateCodeSecurityConfigurationRepositoriesFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +// returns a Parsable when successful +func CreateCodeSecurityConfigurationRepositoriesFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewCodeSecurityConfigurationRepositories(), nil +} +// GetAdditionalData gets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +// returns a map[string]any when successful +func (m *CodeSecurityConfigurationRepositories) GetAdditionalData()(map[string]any) { + return m.additionalData +} +// GetFieldDeserializers the deserialization information for the current model +// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful +func (m *CodeSecurityConfigurationRepositories) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) + res["repository"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(CreateSimpleRepositoryFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetRepository(val.(SimpleRepositoryable)) + } + return nil + } + res["status"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetEnumValue(ParseCodeSecurityConfigurationRepositories_status) + if err != nil { + return err + } + if val != nil { + m.SetStatus(val.(*CodeSecurityConfigurationRepositories_status)) + } + return nil + } + return res +} +// GetRepository gets the repository property value. A GitHub repository. +// returns a SimpleRepositoryable when successful +func (m *CodeSecurityConfigurationRepositories) GetRepository()(SimpleRepositoryable) { + return m.repository +} +// GetStatus gets the status property value. The attachment status of the code security configuration on the repository. +// returns a *CodeSecurityConfigurationRepositories_status when successful +func (m *CodeSecurityConfigurationRepositories) GetStatus()(*CodeSecurityConfigurationRepositories_status) { + return m.status +} +// Serialize serializes information the current object +func (m *CodeSecurityConfigurationRepositories) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + { + err := writer.WriteObjectValue("repository", m.GetRepository()) + if err != nil { + return err + } + } + if m.GetStatus() != nil { + cast := (*m.GetStatus()).String() + err := writer.WriteStringValue("status", &cast) + if err != nil { + return err + } + } + { + err := writer.WriteAdditionalData(m.GetAdditionalData()) + if err != nil { + return err + } + } + return nil +} +// SetAdditionalData sets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *CodeSecurityConfigurationRepositories) SetAdditionalData(value map[string]any)() { + m.additionalData = value +} +// SetRepository sets the repository property value. A GitHub repository. +func (m *CodeSecurityConfigurationRepositories) SetRepository(value SimpleRepositoryable)() { + m.repository = value +} +// SetStatus sets the status property value. The attachment status of the code security configuration on the repository. +func (m *CodeSecurityConfigurationRepositories) SetStatus(value *CodeSecurityConfigurationRepositories_status)() { + m.status = value +} +type CodeSecurityConfigurationRepositoriesable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetRepository()(SimpleRepositoryable) + GetStatus()(*CodeSecurityConfigurationRepositories_status) + SetRepository(value SimpleRepositoryable)() + SetStatus(value *CodeSecurityConfigurationRepositories_status)() +} diff --git a/pkg/github/models/code_security_configuration_repositories_status.go b/pkg/github/models/code_security_configuration_repositories_status.go new file mode 100644 index 00000000..4e0871c7 --- /dev/null +++ b/pkg/github/models/code_security_configuration_repositories_status.go @@ -0,0 +1,49 @@ +package models +import ( + "errors" +) +// The attachment status of the code security configuration on the repository. +type CodeSecurityConfigurationRepositories_status int + +const ( + ATTACHED_CODESECURITYCONFIGURATIONREPOSITORIES_STATUS CodeSecurityConfigurationRepositories_status = iota + ATTACHING_CODESECURITYCONFIGURATIONREPOSITORIES_STATUS + DETACHED_CODESECURITYCONFIGURATIONREPOSITORIES_STATUS + ENFORCED_CODESECURITYCONFIGURATIONREPOSITORIES_STATUS + FAILED_CODESECURITYCONFIGURATIONREPOSITORIES_STATUS + UPDATING_CODESECURITYCONFIGURATIONREPOSITORIES_STATUS +) + +func (i CodeSecurityConfigurationRepositories_status) String() string { + return []string{"attached", "attaching", "detached", "enforced", "failed", "updating"}[i] +} +func ParseCodeSecurityConfigurationRepositories_status(v string) (any, error) { + result := ATTACHED_CODESECURITYCONFIGURATIONREPOSITORIES_STATUS + switch v { + case "attached": + result = ATTACHED_CODESECURITYCONFIGURATIONREPOSITORIES_STATUS + case "attaching": + result = ATTACHING_CODESECURITYCONFIGURATIONREPOSITORIES_STATUS + case "detached": + result = DETACHED_CODESECURITYCONFIGURATIONREPOSITORIES_STATUS + case "enforced": + result = ENFORCED_CODESECURITYCONFIGURATIONREPOSITORIES_STATUS + case "failed": + result = FAILED_CODESECURITYCONFIGURATIONREPOSITORIES_STATUS + case "updating": + result = UPDATING_CODESECURITYCONFIGURATIONREPOSITORIES_STATUS + default: + return 0, errors.New("Unknown CodeSecurityConfigurationRepositories_status value: " + v) + } + return &result, nil +} +func SerializeCodeSecurityConfigurationRepositories_status(values []CodeSecurityConfigurationRepositories_status) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i CodeSecurityConfigurationRepositories_status) isMultiValue() bool { + return false +} diff --git a/pkg/github/models/code_security_configuration_secret_scanning.go b/pkg/github/models/code_security_configuration_secret_scanning.go new file mode 100644 index 00000000..dbbdae86 --- /dev/null +++ b/pkg/github/models/code_security_configuration_secret_scanning.go @@ -0,0 +1,40 @@ +package models +import ( + "errors" +) +// The enablement status of secret scanning +type CodeSecurityConfiguration_secret_scanning int + +const ( + ENABLED_CODESECURITYCONFIGURATION_SECRET_SCANNING CodeSecurityConfiguration_secret_scanning = iota + DISABLED_CODESECURITYCONFIGURATION_SECRET_SCANNING + NOT_SET_CODESECURITYCONFIGURATION_SECRET_SCANNING +) + +func (i CodeSecurityConfiguration_secret_scanning) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseCodeSecurityConfiguration_secret_scanning(v string) (any, error) { + result := ENABLED_CODESECURITYCONFIGURATION_SECRET_SCANNING + switch v { + case "enabled": + result = ENABLED_CODESECURITYCONFIGURATION_SECRET_SCANNING + case "disabled": + result = DISABLED_CODESECURITYCONFIGURATION_SECRET_SCANNING + case "not_set": + result = NOT_SET_CODESECURITYCONFIGURATION_SECRET_SCANNING + default: + return 0, errors.New("Unknown CodeSecurityConfiguration_secret_scanning value: " + v) + } + return &result, nil +} +func SerializeCodeSecurityConfiguration_secret_scanning(values []CodeSecurityConfiguration_secret_scanning) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i CodeSecurityConfiguration_secret_scanning) isMultiValue() bool { + return false +} diff --git a/pkg/github/models/code_security_configuration_secret_scanning_push_protection.go b/pkg/github/models/code_security_configuration_secret_scanning_push_protection.go new file mode 100644 index 00000000..c86ab211 --- /dev/null +++ b/pkg/github/models/code_security_configuration_secret_scanning_push_protection.go @@ -0,0 +1,40 @@ +package models +import ( + "errors" +) +// The enablement status of secret scanning push protection +type CodeSecurityConfiguration_secret_scanning_push_protection int + +const ( + ENABLED_CODESECURITYCONFIGURATION_SECRET_SCANNING_PUSH_PROTECTION CodeSecurityConfiguration_secret_scanning_push_protection = iota + DISABLED_CODESECURITYCONFIGURATION_SECRET_SCANNING_PUSH_PROTECTION + NOT_SET_CODESECURITYCONFIGURATION_SECRET_SCANNING_PUSH_PROTECTION +) + +func (i CodeSecurityConfiguration_secret_scanning_push_protection) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseCodeSecurityConfiguration_secret_scanning_push_protection(v string) (any, error) { + result := ENABLED_CODESECURITYCONFIGURATION_SECRET_SCANNING_PUSH_PROTECTION + switch v { + case "enabled": + result = ENABLED_CODESECURITYCONFIGURATION_SECRET_SCANNING_PUSH_PROTECTION + case "disabled": + result = DISABLED_CODESECURITYCONFIGURATION_SECRET_SCANNING_PUSH_PROTECTION + case "not_set": + result = NOT_SET_CODESECURITYCONFIGURATION_SECRET_SCANNING_PUSH_PROTECTION + default: + return 0, errors.New("Unknown CodeSecurityConfiguration_secret_scanning_push_protection value: " + v) + } + return &result, nil +} +func SerializeCodeSecurityConfiguration_secret_scanning_push_protection(values []CodeSecurityConfiguration_secret_scanning_push_protection) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i CodeSecurityConfiguration_secret_scanning_push_protection) isMultiValue() bool { + return false +} diff --git a/pkg/github/models/code_security_configuration_target_type.go b/pkg/github/models/code_security_configuration_target_type.go new file mode 100644 index 00000000..3cd9704c --- /dev/null +++ b/pkg/github/models/code_security_configuration_target_type.go @@ -0,0 +1,37 @@ +package models +import ( + "errors" +) +// The type of the code security configuration. +type CodeSecurityConfiguration_target_type int + +const ( + GLOBAL_CODESECURITYCONFIGURATION_TARGET_TYPE CodeSecurityConfiguration_target_type = iota + ORGANIZATION_CODESECURITYCONFIGURATION_TARGET_TYPE +) + +func (i CodeSecurityConfiguration_target_type) String() string { + return []string{"global", "organization"}[i] +} +func ParseCodeSecurityConfiguration_target_type(v string) (any, error) { + result := GLOBAL_CODESECURITYCONFIGURATION_TARGET_TYPE + switch v { + case "global": + result = GLOBAL_CODESECURITYCONFIGURATION_TARGET_TYPE + case "organization": + result = ORGANIZATION_CODESECURITYCONFIGURATION_TARGET_TYPE + default: + return 0, errors.New("Unknown CodeSecurityConfiguration_target_type value: " + v) + } + return &result, nil +} +func SerializeCodeSecurityConfiguration_target_type(values []CodeSecurityConfiguration_target_type) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i CodeSecurityConfiguration_target_type) isMultiValue() bool { + return false +} diff --git a/pkg/github/models/code_security_default_configurations.go b/pkg/github/models/code_security_default_configurations.go new file mode 100644 index 00000000..973a1928 --- /dev/null +++ b/pkg/github/models/code_security_default_configurations.go @@ -0,0 +1,110 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +type CodeSecurityDefaultConfigurations struct { + // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additionalData map[string]any + // A code security configuration + configuration CodeSecurityConfigurationable + // The visibility of newly created repositories for which the code security configuration will be applied to by default + default_for_new_repos *CodeSecurityDefaultConfigurations_default_for_new_repos +} +// NewCodeSecurityDefaultConfigurations instantiates a new CodeSecurityDefaultConfigurations and sets the default values. +func NewCodeSecurityDefaultConfigurations()(*CodeSecurityDefaultConfigurations) { + m := &CodeSecurityDefaultConfigurations{ + } + m.SetAdditionalData(make(map[string]any)) + return m +} +// CreateCodeSecurityDefaultConfigurationsFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +// returns a Parsable when successful +func CreateCodeSecurityDefaultConfigurationsFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewCodeSecurityDefaultConfigurations(), nil +} +// GetAdditionalData gets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +// returns a map[string]any when successful +func (m *CodeSecurityDefaultConfigurations) GetAdditionalData()(map[string]any) { + return m.additionalData +} +// GetConfiguration gets the configuration property value. A code security configuration +// returns a CodeSecurityConfigurationable when successful +func (m *CodeSecurityDefaultConfigurations) GetConfiguration()(CodeSecurityConfigurationable) { + return m.configuration +} +// GetDefaultForNewRepos gets the default_for_new_repos property value. The visibility of newly created repositories for which the code security configuration will be applied to by default +// returns a *CodeSecurityDefaultConfigurations_default_for_new_repos when successful +func (m *CodeSecurityDefaultConfigurations) GetDefaultForNewRepos()(*CodeSecurityDefaultConfigurations_default_for_new_repos) { + return m.default_for_new_repos +} +// GetFieldDeserializers the deserialization information for the current model +// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful +func (m *CodeSecurityDefaultConfigurations) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) + res["configuration"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(CreateCodeSecurityConfigurationFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetConfiguration(val.(CodeSecurityConfigurationable)) + } + return nil + } + res["default_for_new_repos"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetEnumValue(ParseCodeSecurityDefaultConfigurations_default_for_new_repos) + if err != nil { + return err + } + if val != nil { + m.SetDefaultForNewRepos(val.(*CodeSecurityDefaultConfigurations_default_for_new_repos)) + } + return nil + } + return res +} +// Serialize serializes information the current object +func (m *CodeSecurityDefaultConfigurations) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + { + err := writer.WriteObjectValue("configuration", m.GetConfiguration()) + if err != nil { + return err + } + } + if m.GetDefaultForNewRepos() != nil { + cast := (*m.GetDefaultForNewRepos()).String() + err := writer.WriteStringValue("default_for_new_repos", &cast) + if err != nil { + return err + } + } + { + err := writer.WriteAdditionalData(m.GetAdditionalData()) + if err != nil { + return err + } + } + return nil +} +// SetAdditionalData sets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *CodeSecurityDefaultConfigurations) SetAdditionalData(value map[string]any)() { + m.additionalData = value +} +// SetConfiguration sets the configuration property value. A code security configuration +func (m *CodeSecurityDefaultConfigurations) SetConfiguration(value CodeSecurityConfigurationable)() { + m.configuration = value +} +// SetDefaultForNewRepos sets the default_for_new_repos property value. The visibility of newly created repositories for which the code security configuration will be applied to by default +func (m *CodeSecurityDefaultConfigurations) SetDefaultForNewRepos(value *CodeSecurityDefaultConfigurations_default_for_new_repos)() { + m.default_for_new_repos = value +} +type CodeSecurityDefaultConfigurationsable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetConfiguration()(CodeSecurityConfigurationable) + GetDefaultForNewRepos()(*CodeSecurityDefaultConfigurations_default_for_new_repos) + SetConfiguration(value CodeSecurityConfigurationable)() + SetDefaultForNewRepos(value *CodeSecurityDefaultConfigurations_default_for_new_repos)() +} diff --git a/pkg/github/models/code_security_default_configurations_default_for_new_repos.go b/pkg/github/models/code_security_default_configurations_default_for_new_repos.go new file mode 100644 index 00000000..bbb7cbed --- /dev/null +++ b/pkg/github/models/code_security_default_configurations_default_for_new_repos.go @@ -0,0 +1,40 @@ +package models +import ( + "errors" +) +// The visibility of newly created repositories for which the code security configuration will be applied to by default +type CodeSecurityDefaultConfigurations_default_for_new_repos int + +const ( + PUBLIC_CODESECURITYDEFAULTCONFIGURATIONS_DEFAULT_FOR_NEW_REPOS CodeSecurityDefaultConfigurations_default_for_new_repos = iota + PRIVATE_AND_INTERNAL_CODESECURITYDEFAULTCONFIGURATIONS_DEFAULT_FOR_NEW_REPOS + ALL_CODESECURITYDEFAULTCONFIGURATIONS_DEFAULT_FOR_NEW_REPOS +) + +func (i CodeSecurityDefaultConfigurations_default_for_new_repos) String() string { + return []string{"public", "private_and_internal", "all"}[i] +} +func ParseCodeSecurityDefaultConfigurations_default_for_new_repos(v string) (any, error) { + result := PUBLIC_CODESECURITYDEFAULTCONFIGURATIONS_DEFAULT_FOR_NEW_REPOS + switch v { + case "public": + result = PUBLIC_CODESECURITYDEFAULTCONFIGURATIONS_DEFAULT_FOR_NEW_REPOS + case "private_and_internal": + result = PRIVATE_AND_INTERNAL_CODESECURITYDEFAULTCONFIGURATIONS_DEFAULT_FOR_NEW_REPOS + case "all": + result = ALL_CODESECURITYDEFAULTCONFIGURATIONS_DEFAULT_FOR_NEW_REPOS + default: + return 0, errors.New("Unknown CodeSecurityDefaultConfigurations_default_for_new_repos value: " + v) + } + return &result, nil +} +func SerializeCodeSecurityDefaultConfigurations_default_for_new_repos(values []CodeSecurityDefaultConfigurations_default_for_new_repos) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i CodeSecurityDefaultConfigurations_default_for_new_repos) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_advanced_security.go b/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_advanced_security.go new file mode 100644 index 00000000..cecb782b --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_advanced_security.go @@ -0,0 +1,37 @@ +package configurations +import ( + "errors" +) +// The enablement status of GitHub Advanced Security +type ConfigurationsPostRequestBody_advanced_security int + +const ( + ENABLED_CONFIGURATIONSPOSTREQUESTBODY_ADVANCED_SECURITY ConfigurationsPostRequestBody_advanced_security = iota + DISABLED_CONFIGURATIONSPOSTREQUESTBODY_ADVANCED_SECURITY +) + +func (i ConfigurationsPostRequestBody_advanced_security) String() string { + return []string{"enabled", "disabled"}[i] +} +func ParseConfigurationsPostRequestBody_advanced_security(v string) (any, error) { + result := ENABLED_CONFIGURATIONSPOSTREQUESTBODY_ADVANCED_SECURITY + switch v { + case "enabled": + result = ENABLED_CONFIGURATIONSPOSTREQUESTBODY_ADVANCED_SECURITY + case "disabled": + result = DISABLED_CONFIGURATIONSPOSTREQUESTBODY_ADVANCED_SECURITY + default: + return 0, errors.New("Unknown ConfigurationsPostRequestBody_advanced_security value: " + v) + } + return &result, nil +} +func SerializeConfigurationsPostRequestBody_advanced_security(values []ConfigurationsPostRequestBody_advanced_security) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i ConfigurationsPostRequestBody_advanced_security) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_code_scanning_default_setup.go b/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_code_scanning_default_setup.go new file mode 100644 index 00000000..b18aa0bf --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_code_scanning_default_setup.go @@ -0,0 +1,40 @@ +package configurations +import ( + "errors" +) +// The enablement status of code scanning default setup +type ConfigurationsPostRequestBody_code_scanning_default_setup int + +const ( + ENABLED_CONFIGURATIONSPOSTREQUESTBODY_CODE_SCANNING_DEFAULT_SETUP ConfigurationsPostRequestBody_code_scanning_default_setup = iota + DISABLED_CONFIGURATIONSPOSTREQUESTBODY_CODE_SCANNING_DEFAULT_SETUP + NOT_SET_CONFIGURATIONSPOSTREQUESTBODY_CODE_SCANNING_DEFAULT_SETUP +) + +func (i ConfigurationsPostRequestBody_code_scanning_default_setup) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseConfigurationsPostRequestBody_code_scanning_default_setup(v string) (any, error) { + result := ENABLED_CONFIGURATIONSPOSTREQUESTBODY_CODE_SCANNING_DEFAULT_SETUP + switch v { + case "enabled": + result = ENABLED_CONFIGURATIONSPOSTREQUESTBODY_CODE_SCANNING_DEFAULT_SETUP + case "disabled": + result = DISABLED_CONFIGURATIONSPOSTREQUESTBODY_CODE_SCANNING_DEFAULT_SETUP + case "not_set": + result = NOT_SET_CONFIGURATIONSPOSTREQUESTBODY_CODE_SCANNING_DEFAULT_SETUP + default: + return 0, errors.New("Unknown ConfigurationsPostRequestBody_code_scanning_default_setup value: " + v) + } + return &result, nil +} +func SerializeConfigurationsPostRequestBody_code_scanning_default_setup(values []ConfigurationsPostRequestBody_code_scanning_default_setup) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i ConfigurationsPostRequestBody_code_scanning_default_setup) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_dependabot_alerts.go b/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_dependabot_alerts.go new file mode 100644 index 00000000..9a83b7c5 --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_dependabot_alerts.go @@ -0,0 +1,40 @@ +package configurations +import ( + "errors" +) +// The enablement status of Dependabot alerts +type ConfigurationsPostRequestBody_dependabot_alerts int + +const ( + ENABLED_CONFIGURATIONSPOSTREQUESTBODY_DEPENDABOT_ALERTS ConfigurationsPostRequestBody_dependabot_alerts = iota + DISABLED_CONFIGURATIONSPOSTREQUESTBODY_DEPENDABOT_ALERTS + NOT_SET_CONFIGURATIONSPOSTREQUESTBODY_DEPENDABOT_ALERTS +) + +func (i ConfigurationsPostRequestBody_dependabot_alerts) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseConfigurationsPostRequestBody_dependabot_alerts(v string) (any, error) { + result := ENABLED_CONFIGURATIONSPOSTREQUESTBODY_DEPENDABOT_ALERTS + switch v { + case "enabled": + result = ENABLED_CONFIGURATIONSPOSTREQUESTBODY_DEPENDABOT_ALERTS + case "disabled": + result = DISABLED_CONFIGURATIONSPOSTREQUESTBODY_DEPENDABOT_ALERTS + case "not_set": + result = NOT_SET_CONFIGURATIONSPOSTREQUESTBODY_DEPENDABOT_ALERTS + default: + return 0, errors.New("Unknown ConfigurationsPostRequestBody_dependabot_alerts value: " + v) + } + return &result, nil +} +func SerializeConfigurationsPostRequestBody_dependabot_alerts(values []ConfigurationsPostRequestBody_dependabot_alerts) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i ConfigurationsPostRequestBody_dependabot_alerts) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_dependabot_security_updates.go b/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_dependabot_security_updates.go new file mode 100644 index 00000000..bb975a4f --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_dependabot_security_updates.go @@ -0,0 +1,40 @@ +package configurations +import ( + "errors" +) +// The enablement status of Dependabot security updates +type ConfigurationsPostRequestBody_dependabot_security_updates int + +const ( + ENABLED_CONFIGURATIONSPOSTREQUESTBODY_DEPENDABOT_SECURITY_UPDATES ConfigurationsPostRequestBody_dependabot_security_updates = iota + DISABLED_CONFIGURATIONSPOSTREQUESTBODY_DEPENDABOT_SECURITY_UPDATES + NOT_SET_CONFIGURATIONSPOSTREQUESTBODY_DEPENDABOT_SECURITY_UPDATES +) + +func (i ConfigurationsPostRequestBody_dependabot_security_updates) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseConfigurationsPostRequestBody_dependabot_security_updates(v string) (any, error) { + result := ENABLED_CONFIGURATIONSPOSTREQUESTBODY_DEPENDABOT_SECURITY_UPDATES + switch v { + case "enabled": + result = ENABLED_CONFIGURATIONSPOSTREQUESTBODY_DEPENDABOT_SECURITY_UPDATES + case "disabled": + result = DISABLED_CONFIGURATIONSPOSTREQUESTBODY_DEPENDABOT_SECURITY_UPDATES + case "not_set": + result = NOT_SET_CONFIGURATIONSPOSTREQUESTBODY_DEPENDABOT_SECURITY_UPDATES + default: + return 0, errors.New("Unknown ConfigurationsPostRequestBody_dependabot_security_updates value: " + v) + } + return &result, nil +} +func SerializeConfigurationsPostRequestBody_dependabot_security_updates(values []ConfigurationsPostRequestBody_dependabot_security_updates) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i ConfigurationsPostRequestBody_dependabot_security_updates) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_dependency_graph.go b/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_dependency_graph.go new file mode 100644 index 00000000..80a486f0 --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_dependency_graph.go @@ -0,0 +1,40 @@ +package configurations +import ( + "errors" +) +// The enablement status of Dependency Graph +type ConfigurationsPostRequestBody_dependency_graph int + +const ( + ENABLED_CONFIGURATIONSPOSTREQUESTBODY_DEPENDENCY_GRAPH ConfigurationsPostRequestBody_dependency_graph = iota + DISABLED_CONFIGURATIONSPOSTREQUESTBODY_DEPENDENCY_GRAPH + NOT_SET_CONFIGURATIONSPOSTREQUESTBODY_DEPENDENCY_GRAPH +) + +func (i ConfigurationsPostRequestBody_dependency_graph) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseConfigurationsPostRequestBody_dependency_graph(v string) (any, error) { + result := ENABLED_CONFIGURATIONSPOSTREQUESTBODY_DEPENDENCY_GRAPH + switch v { + case "enabled": + result = ENABLED_CONFIGURATIONSPOSTREQUESTBODY_DEPENDENCY_GRAPH + case "disabled": + result = DISABLED_CONFIGURATIONSPOSTREQUESTBODY_DEPENDENCY_GRAPH + case "not_set": + result = NOT_SET_CONFIGURATIONSPOSTREQUESTBODY_DEPENDENCY_GRAPH + default: + return 0, errors.New("Unknown ConfigurationsPostRequestBody_dependency_graph value: " + v) + } + return &result, nil +} +func SerializeConfigurationsPostRequestBody_dependency_graph(values []ConfigurationsPostRequestBody_dependency_graph) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i ConfigurationsPostRequestBody_dependency_graph) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_private_vulnerability_reporting.go b/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_private_vulnerability_reporting.go new file mode 100644 index 00000000..c8b98e59 --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_private_vulnerability_reporting.go @@ -0,0 +1,40 @@ +package configurations +import ( + "errors" +) +// The enablement status of private vulnerability reporting +type ConfigurationsPostRequestBody_private_vulnerability_reporting int + +const ( + ENABLED_CONFIGURATIONSPOSTREQUESTBODY_PRIVATE_VULNERABILITY_REPORTING ConfigurationsPostRequestBody_private_vulnerability_reporting = iota + DISABLED_CONFIGURATIONSPOSTREQUESTBODY_PRIVATE_VULNERABILITY_REPORTING + NOT_SET_CONFIGURATIONSPOSTREQUESTBODY_PRIVATE_VULNERABILITY_REPORTING +) + +func (i ConfigurationsPostRequestBody_private_vulnerability_reporting) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseConfigurationsPostRequestBody_private_vulnerability_reporting(v string) (any, error) { + result := ENABLED_CONFIGURATIONSPOSTREQUESTBODY_PRIVATE_VULNERABILITY_REPORTING + switch v { + case "enabled": + result = ENABLED_CONFIGURATIONSPOSTREQUESTBODY_PRIVATE_VULNERABILITY_REPORTING + case "disabled": + result = DISABLED_CONFIGURATIONSPOSTREQUESTBODY_PRIVATE_VULNERABILITY_REPORTING + case "not_set": + result = NOT_SET_CONFIGURATIONSPOSTREQUESTBODY_PRIVATE_VULNERABILITY_REPORTING + default: + return 0, errors.New("Unknown ConfigurationsPostRequestBody_private_vulnerability_reporting value: " + v) + } + return &result, nil +} +func SerializeConfigurationsPostRequestBody_private_vulnerability_reporting(values []ConfigurationsPostRequestBody_private_vulnerability_reporting) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i ConfigurationsPostRequestBody_private_vulnerability_reporting) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_secret_scanning.go b/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_secret_scanning.go new file mode 100644 index 00000000..97ae2a45 --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_secret_scanning.go @@ -0,0 +1,40 @@ +package configurations +import ( + "errors" +) +// The enablement status of secret scanning +type ConfigurationsPostRequestBody_secret_scanning int + +const ( + ENABLED_CONFIGURATIONSPOSTREQUESTBODY_SECRET_SCANNING ConfigurationsPostRequestBody_secret_scanning = iota + DISABLED_CONFIGURATIONSPOSTREQUESTBODY_SECRET_SCANNING + NOT_SET_CONFIGURATIONSPOSTREQUESTBODY_SECRET_SCANNING +) + +func (i ConfigurationsPostRequestBody_secret_scanning) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseConfigurationsPostRequestBody_secret_scanning(v string) (any, error) { + result := ENABLED_CONFIGURATIONSPOSTREQUESTBODY_SECRET_SCANNING + switch v { + case "enabled": + result = ENABLED_CONFIGURATIONSPOSTREQUESTBODY_SECRET_SCANNING + case "disabled": + result = DISABLED_CONFIGURATIONSPOSTREQUESTBODY_SECRET_SCANNING + case "not_set": + result = NOT_SET_CONFIGURATIONSPOSTREQUESTBODY_SECRET_SCANNING + default: + return 0, errors.New("Unknown ConfigurationsPostRequestBody_secret_scanning value: " + v) + } + return &result, nil +} +func SerializeConfigurationsPostRequestBody_secret_scanning(values []ConfigurationsPostRequestBody_secret_scanning) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i ConfigurationsPostRequestBody_secret_scanning) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_secret_scanning_push_protection.go b/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_secret_scanning_push_protection.go new file mode 100644 index 00000000..3f411e47 --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/configurations_post_request_body_secret_scanning_push_protection.go @@ -0,0 +1,40 @@ +package configurations +import ( + "errors" +) +// The enablement status of secret scanning push protection +type ConfigurationsPostRequestBody_secret_scanning_push_protection int + +const ( + ENABLED_CONFIGURATIONSPOSTREQUESTBODY_SECRET_SCANNING_PUSH_PROTECTION ConfigurationsPostRequestBody_secret_scanning_push_protection = iota + DISABLED_CONFIGURATIONSPOSTREQUESTBODY_SECRET_SCANNING_PUSH_PROTECTION + NOT_SET_CONFIGURATIONSPOSTREQUESTBODY_SECRET_SCANNING_PUSH_PROTECTION +) + +func (i ConfigurationsPostRequestBody_secret_scanning_push_protection) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseConfigurationsPostRequestBody_secret_scanning_push_protection(v string) (any, error) { + result := ENABLED_CONFIGURATIONSPOSTREQUESTBODY_SECRET_SCANNING_PUSH_PROTECTION + switch v { + case "enabled": + result = ENABLED_CONFIGURATIONSPOSTREQUESTBODY_SECRET_SCANNING_PUSH_PROTECTION + case "disabled": + result = DISABLED_CONFIGURATIONSPOSTREQUESTBODY_SECRET_SCANNING_PUSH_PROTECTION + case "not_set": + result = NOT_SET_CONFIGURATIONSPOSTREQUESTBODY_SECRET_SCANNING_PUSH_PROTECTION + default: + return 0, errors.New("Unknown ConfigurationsPostRequestBody_secret_scanning_push_protection value: " + v) + } + return &result, nil +} +func SerializeConfigurationsPostRequestBody_secret_scanning_push_protection(values []ConfigurationsPostRequestBody_secret_scanning_push_protection) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i ConfigurationsPostRequestBody_secret_scanning_push_protection) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/get_target_type_query_parameter_type.go b/pkg/github/orgs/item/codesecurity/configurations/get_target_type_query_parameter_type.go new file mode 100644 index 00000000..2dd790b4 --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/get_target_type_query_parameter_type.go @@ -0,0 +1,36 @@ +package configurations +import ( + "errors" +) +type GetTarget_typeQueryParameterType int + +const ( + GLOBAL_GETTARGET_TYPEQUERYPARAMETERTYPE GetTarget_typeQueryParameterType = iota + ALL_GETTARGET_TYPEQUERYPARAMETERTYPE +) + +func (i GetTarget_typeQueryParameterType) String() string { + return []string{"global", "all"}[i] +} +func ParseGetTarget_typeQueryParameterType(v string) (any, error) { + result := GLOBAL_GETTARGET_TYPEQUERYPARAMETERTYPE + switch v { + case "global": + result = GLOBAL_GETTARGET_TYPEQUERYPARAMETERTYPE + case "all": + result = ALL_GETTARGET_TYPEQUERYPARAMETERTYPE + default: + return 0, errors.New("Unknown GetTarget_typeQueryParameterType value: " + v) + } + return &result, nil +} +func SerializeGetTarget_typeQueryParameterType(values []GetTarget_typeQueryParameterType) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i GetTarget_typeQueryParameterType) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/item/attach/attach_post_request_body_scope.go b/pkg/github/orgs/item/codesecurity/configurations/item/attach/attach_post_request_body_scope.go new file mode 100644 index 00000000..0619def8 --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/item/attach/attach_post_request_body_scope.go @@ -0,0 +1,43 @@ +package attach +import ( + "errors" +) +// The type of repositories to attach the configuration to. `selected` means the configuration will be attached to only the repositories specified by `selected_repository_ids` +type AttachPostRequestBody_scope int + +const ( + ALL_ATTACHPOSTREQUESTBODY_SCOPE AttachPostRequestBody_scope = iota + PUBLIC_ATTACHPOSTREQUESTBODY_SCOPE + PRIVATE_OR_INTERNAL_ATTACHPOSTREQUESTBODY_SCOPE + SELECTED_ATTACHPOSTREQUESTBODY_SCOPE +) + +func (i AttachPostRequestBody_scope) String() string { + return []string{"all", "public", "private_or_internal", "selected"}[i] +} +func ParseAttachPostRequestBody_scope(v string) (any, error) { + result := ALL_ATTACHPOSTREQUESTBODY_SCOPE + switch v { + case "all": + result = ALL_ATTACHPOSTREQUESTBODY_SCOPE + case "public": + result = PUBLIC_ATTACHPOSTREQUESTBODY_SCOPE + case "private_or_internal": + result = PRIVATE_OR_INTERNAL_ATTACHPOSTREQUESTBODY_SCOPE + case "selected": + result = SELECTED_ATTACHPOSTREQUESTBODY_SCOPE + default: + return 0, errors.New("Unknown AttachPostRequestBody_scope value: " + v) + } + return &result, nil +} +func SerializeAttachPostRequestBody_scope(values []AttachPostRequestBody_scope) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i AttachPostRequestBody_scope) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/item/defaults/defaults_put_request_body_default_for_new_repos.go b/pkg/github/orgs/item/codesecurity/configurations/item/defaults/defaults_put_request_body_default_for_new_repos.go new file mode 100644 index 00000000..aa6f264a --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/item/defaults/defaults_put_request_body_default_for_new_repos.go @@ -0,0 +1,43 @@ +package defaults +import ( + "errors" +) +// Specify which types of repository this security configuration should be applied to by default. +type DefaultsPutRequestBody_default_for_new_repos int + +const ( + ALL_DEFAULTSPUTREQUESTBODY_DEFAULT_FOR_NEW_REPOS DefaultsPutRequestBody_default_for_new_repos = iota + NONE_DEFAULTSPUTREQUESTBODY_DEFAULT_FOR_NEW_REPOS + PRIVATE_AND_INTERNAL_DEFAULTSPUTREQUESTBODY_DEFAULT_FOR_NEW_REPOS + PUBLIC_DEFAULTSPUTREQUESTBODY_DEFAULT_FOR_NEW_REPOS +) + +func (i DefaultsPutRequestBody_default_for_new_repos) String() string { + return []string{"all", "none", "private_and_internal", "public"}[i] +} +func ParseDefaultsPutRequestBody_default_for_new_repos(v string) (any, error) { + result := ALL_DEFAULTSPUTREQUESTBODY_DEFAULT_FOR_NEW_REPOS + switch v { + case "all": + result = ALL_DEFAULTSPUTREQUESTBODY_DEFAULT_FOR_NEW_REPOS + case "none": + result = NONE_DEFAULTSPUTREQUESTBODY_DEFAULT_FOR_NEW_REPOS + case "private_and_internal": + result = PRIVATE_AND_INTERNAL_DEFAULTSPUTREQUESTBODY_DEFAULT_FOR_NEW_REPOS + case "public": + result = PUBLIC_DEFAULTSPUTREQUESTBODY_DEFAULT_FOR_NEW_REPOS + default: + return 0, errors.New("Unknown DefaultsPutRequestBody_default_for_new_repos value: " + v) + } + return &result, nil +} +func SerializeDefaultsPutRequestBody_default_for_new_repos(values []DefaultsPutRequestBody_default_for_new_repos) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i DefaultsPutRequestBody_default_for_new_repos) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/item/defaults/defaults_put_response_default_for_new_repos.go b/pkg/github/orgs/item/codesecurity/configurations/item/defaults/defaults_put_response_default_for_new_repos.go new file mode 100644 index 00000000..decd4fce --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/item/defaults/defaults_put_response_default_for_new_repos.go @@ -0,0 +1,43 @@ +package defaults +import ( + "errors" +) +// Specifies which types of repository this security configuration is applied to by default. +type DefaultsPutResponse_default_for_new_repos int + +const ( + ALL_DEFAULTSPUTRESPONSE_DEFAULT_FOR_NEW_REPOS DefaultsPutResponse_default_for_new_repos = iota + NONE_DEFAULTSPUTRESPONSE_DEFAULT_FOR_NEW_REPOS + PRIVATE_AND_INTERNAL_DEFAULTSPUTRESPONSE_DEFAULT_FOR_NEW_REPOS + PUBLIC_DEFAULTSPUTRESPONSE_DEFAULT_FOR_NEW_REPOS +) + +func (i DefaultsPutResponse_default_for_new_repos) String() string { + return []string{"all", "none", "private_and_internal", "public"}[i] +} +func ParseDefaultsPutResponse_default_for_new_repos(v string) (any, error) { + result := ALL_DEFAULTSPUTRESPONSE_DEFAULT_FOR_NEW_REPOS + switch v { + case "all": + result = ALL_DEFAULTSPUTRESPONSE_DEFAULT_FOR_NEW_REPOS + case "none": + result = NONE_DEFAULTSPUTRESPONSE_DEFAULT_FOR_NEW_REPOS + case "private_and_internal": + result = PRIVATE_AND_INTERNAL_DEFAULTSPUTRESPONSE_DEFAULT_FOR_NEW_REPOS + case "public": + result = PUBLIC_DEFAULTSPUTRESPONSE_DEFAULT_FOR_NEW_REPOS + default: + return 0, errors.New("Unknown DefaultsPutResponse_default_for_new_repos value: " + v) + } + return &result, nil +} +func SerializeDefaultsPutResponse_default_for_new_repos(values []DefaultsPutResponse_default_for_new_repos) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i DefaultsPutResponse_default_for_new_repos) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_advanced_security.go b/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_advanced_security.go new file mode 100644 index 00000000..2bbc9594 --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_advanced_security.go @@ -0,0 +1,37 @@ +package item +import ( + "errors" +) +// The enablement status of GitHub Advanced Security +type WithConfiguration_PatchRequestBody_advanced_security int + +const ( + ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_ADVANCED_SECURITY WithConfiguration_PatchRequestBody_advanced_security = iota + DISABLED_WITHCONFIGURATION_PATCHREQUESTBODY_ADVANCED_SECURITY +) + +func (i WithConfiguration_PatchRequestBody_advanced_security) String() string { + return []string{"enabled", "disabled"}[i] +} +func ParseWithConfiguration_PatchRequestBody_advanced_security(v string) (any, error) { + result := ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_ADVANCED_SECURITY + switch v { + case "enabled": + result = ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_ADVANCED_SECURITY + case "disabled": + result = DISABLED_WITHCONFIGURATION_PATCHREQUESTBODY_ADVANCED_SECURITY + default: + return 0, errors.New("Unknown WithConfiguration_PatchRequestBody_advanced_security value: " + v) + } + return &result, nil +} +func SerializeWithConfiguration_PatchRequestBody_advanced_security(values []WithConfiguration_PatchRequestBody_advanced_security) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i WithConfiguration_PatchRequestBody_advanced_security) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_code_scanning_default_setup.go b/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_code_scanning_default_setup.go new file mode 100644 index 00000000..a7bc3940 --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_code_scanning_default_setup.go @@ -0,0 +1,40 @@ +package item +import ( + "errors" +) +// The enablement status of code scanning default setup +type WithConfiguration_PatchRequestBody_code_scanning_default_setup int + +const ( + ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_CODE_SCANNING_DEFAULT_SETUP WithConfiguration_PatchRequestBody_code_scanning_default_setup = iota + DISABLED_WITHCONFIGURATION_PATCHREQUESTBODY_CODE_SCANNING_DEFAULT_SETUP + NOT_SET_WITHCONFIGURATION_PATCHREQUESTBODY_CODE_SCANNING_DEFAULT_SETUP +) + +func (i WithConfiguration_PatchRequestBody_code_scanning_default_setup) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseWithConfiguration_PatchRequestBody_code_scanning_default_setup(v string) (any, error) { + result := ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_CODE_SCANNING_DEFAULT_SETUP + switch v { + case "enabled": + result = ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_CODE_SCANNING_DEFAULT_SETUP + case "disabled": + result = DISABLED_WITHCONFIGURATION_PATCHREQUESTBODY_CODE_SCANNING_DEFAULT_SETUP + case "not_set": + result = NOT_SET_WITHCONFIGURATION_PATCHREQUESTBODY_CODE_SCANNING_DEFAULT_SETUP + default: + return 0, errors.New("Unknown WithConfiguration_PatchRequestBody_code_scanning_default_setup value: " + v) + } + return &result, nil +} +func SerializeWithConfiguration_PatchRequestBody_code_scanning_default_setup(values []WithConfiguration_PatchRequestBody_code_scanning_default_setup) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i WithConfiguration_PatchRequestBody_code_scanning_default_setup) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_dependabot_alerts.go b/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_dependabot_alerts.go new file mode 100644 index 00000000..888e98b2 --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_dependabot_alerts.go @@ -0,0 +1,40 @@ +package item +import ( + "errors" +) +// The enablement status of Dependabot alerts +type WithConfiguration_PatchRequestBody_dependabot_alerts int + +const ( + ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDABOT_ALERTS WithConfiguration_PatchRequestBody_dependabot_alerts = iota + DISABLED_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDABOT_ALERTS + NOT_SET_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDABOT_ALERTS +) + +func (i WithConfiguration_PatchRequestBody_dependabot_alerts) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseWithConfiguration_PatchRequestBody_dependabot_alerts(v string) (any, error) { + result := ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDABOT_ALERTS + switch v { + case "enabled": + result = ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDABOT_ALERTS + case "disabled": + result = DISABLED_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDABOT_ALERTS + case "not_set": + result = NOT_SET_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDABOT_ALERTS + default: + return 0, errors.New("Unknown WithConfiguration_PatchRequestBody_dependabot_alerts value: " + v) + } + return &result, nil +} +func SerializeWithConfiguration_PatchRequestBody_dependabot_alerts(values []WithConfiguration_PatchRequestBody_dependabot_alerts) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i WithConfiguration_PatchRequestBody_dependabot_alerts) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_dependabot_security_updates.go b/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_dependabot_security_updates.go new file mode 100644 index 00000000..42fc0072 --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_dependabot_security_updates.go @@ -0,0 +1,40 @@ +package item +import ( + "errors" +) +// The enablement status of Dependabot security updates +type WithConfiguration_PatchRequestBody_dependabot_security_updates int + +const ( + ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDABOT_SECURITY_UPDATES WithConfiguration_PatchRequestBody_dependabot_security_updates = iota + DISABLED_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDABOT_SECURITY_UPDATES + NOT_SET_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDABOT_SECURITY_UPDATES +) + +func (i WithConfiguration_PatchRequestBody_dependabot_security_updates) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseWithConfiguration_PatchRequestBody_dependabot_security_updates(v string) (any, error) { + result := ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDABOT_SECURITY_UPDATES + switch v { + case "enabled": + result = ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDABOT_SECURITY_UPDATES + case "disabled": + result = DISABLED_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDABOT_SECURITY_UPDATES + case "not_set": + result = NOT_SET_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDABOT_SECURITY_UPDATES + default: + return 0, errors.New("Unknown WithConfiguration_PatchRequestBody_dependabot_security_updates value: " + v) + } + return &result, nil +} +func SerializeWithConfiguration_PatchRequestBody_dependabot_security_updates(values []WithConfiguration_PatchRequestBody_dependabot_security_updates) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i WithConfiguration_PatchRequestBody_dependabot_security_updates) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_dependency_graph.go b/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_dependency_graph.go new file mode 100644 index 00000000..88c64444 --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_dependency_graph.go @@ -0,0 +1,40 @@ +package item +import ( + "errors" +) +// The enablement status of Dependency Graph +type WithConfiguration_PatchRequestBody_dependency_graph int + +const ( + ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDENCY_GRAPH WithConfiguration_PatchRequestBody_dependency_graph = iota + DISABLED_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDENCY_GRAPH + NOT_SET_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDENCY_GRAPH +) + +func (i WithConfiguration_PatchRequestBody_dependency_graph) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseWithConfiguration_PatchRequestBody_dependency_graph(v string) (any, error) { + result := ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDENCY_GRAPH + switch v { + case "enabled": + result = ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDENCY_GRAPH + case "disabled": + result = DISABLED_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDENCY_GRAPH + case "not_set": + result = NOT_SET_WITHCONFIGURATION_PATCHREQUESTBODY_DEPENDENCY_GRAPH + default: + return 0, errors.New("Unknown WithConfiguration_PatchRequestBody_dependency_graph value: " + v) + } + return &result, nil +} +func SerializeWithConfiguration_PatchRequestBody_dependency_graph(values []WithConfiguration_PatchRequestBody_dependency_graph) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i WithConfiguration_PatchRequestBody_dependency_graph) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_private_vulnerability_reporting.go b/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_private_vulnerability_reporting.go new file mode 100644 index 00000000..9b653389 --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_private_vulnerability_reporting.go @@ -0,0 +1,40 @@ +package item +import ( + "errors" +) +// The enablement status of private vulnerability reporting +type WithConfiguration_PatchRequestBody_private_vulnerability_reporting int + +const ( + ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_PRIVATE_VULNERABILITY_REPORTING WithConfiguration_PatchRequestBody_private_vulnerability_reporting = iota + DISABLED_WITHCONFIGURATION_PATCHREQUESTBODY_PRIVATE_VULNERABILITY_REPORTING + NOT_SET_WITHCONFIGURATION_PATCHREQUESTBODY_PRIVATE_VULNERABILITY_REPORTING +) + +func (i WithConfiguration_PatchRequestBody_private_vulnerability_reporting) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseWithConfiguration_PatchRequestBody_private_vulnerability_reporting(v string) (any, error) { + result := ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_PRIVATE_VULNERABILITY_REPORTING + switch v { + case "enabled": + result = ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_PRIVATE_VULNERABILITY_REPORTING + case "disabled": + result = DISABLED_WITHCONFIGURATION_PATCHREQUESTBODY_PRIVATE_VULNERABILITY_REPORTING + case "not_set": + result = NOT_SET_WITHCONFIGURATION_PATCHREQUESTBODY_PRIVATE_VULNERABILITY_REPORTING + default: + return 0, errors.New("Unknown WithConfiguration_PatchRequestBody_private_vulnerability_reporting value: " + v) + } + return &result, nil +} +func SerializeWithConfiguration_PatchRequestBody_private_vulnerability_reporting(values []WithConfiguration_PatchRequestBody_private_vulnerability_reporting) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i WithConfiguration_PatchRequestBody_private_vulnerability_reporting) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_secret_scanning.go b/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_secret_scanning.go new file mode 100644 index 00000000..88a203c2 --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_secret_scanning.go @@ -0,0 +1,40 @@ +package item +import ( + "errors" +) +// The enablement status of secret scanning +type WithConfiguration_PatchRequestBody_secret_scanning int + +const ( + ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_SECRET_SCANNING WithConfiguration_PatchRequestBody_secret_scanning = iota + DISABLED_WITHCONFIGURATION_PATCHREQUESTBODY_SECRET_SCANNING + NOT_SET_WITHCONFIGURATION_PATCHREQUESTBODY_SECRET_SCANNING +) + +func (i WithConfiguration_PatchRequestBody_secret_scanning) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseWithConfiguration_PatchRequestBody_secret_scanning(v string) (any, error) { + result := ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_SECRET_SCANNING + switch v { + case "enabled": + result = ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_SECRET_SCANNING + case "disabled": + result = DISABLED_WITHCONFIGURATION_PATCHREQUESTBODY_SECRET_SCANNING + case "not_set": + result = NOT_SET_WITHCONFIGURATION_PATCHREQUESTBODY_SECRET_SCANNING + default: + return 0, errors.New("Unknown WithConfiguration_PatchRequestBody_secret_scanning value: " + v) + } + return &result, nil +} +func SerializeWithConfiguration_PatchRequestBody_secret_scanning(values []WithConfiguration_PatchRequestBody_secret_scanning) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i WithConfiguration_PatchRequestBody_secret_scanning) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_secret_scanning_push_protection.go b/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_secret_scanning_push_protection.go new file mode 100644 index 00000000..0ae4f300 --- /dev/null +++ b/pkg/github/orgs/item/codesecurity/configurations/item/with_configuration_patch_request_body_secret_scanning_push_protection.go @@ -0,0 +1,40 @@ +package item +import ( + "errors" +) +// The enablement status of secret scanning push protection +type WithConfiguration_PatchRequestBody_secret_scanning_push_protection int + +const ( + ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_SECRET_SCANNING_PUSH_PROTECTION WithConfiguration_PatchRequestBody_secret_scanning_push_protection = iota + DISABLED_WITHCONFIGURATION_PATCHREQUESTBODY_SECRET_SCANNING_PUSH_PROTECTION + NOT_SET_WITHCONFIGURATION_PATCHREQUESTBODY_SECRET_SCANNING_PUSH_PROTECTION +) + +func (i WithConfiguration_PatchRequestBody_secret_scanning_push_protection) String() string { + return []string{"enabled", "disabled", "not_set"}[i] +} +func ParseWithConfiguration_PatchRequestBody_secret_scanning_push_protection(v string) (any, error) { + result := ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_SECRET_SCANNING_PUSH_PROTECTION + switch v { + case "enabled": + result = ENABLED_WITHCONFIGURATION_PATCHREQUESTBODY_SECRET_SCANNING_PUSH_PROTECTION + case "disabled": + result = DISABLED_WITHCONFIGURATION_PATCHREQUESTBODY_SECRET_SCANNING_PUSH_PROTECTION + case "not_set": + result = NOT_SET_WITHCONFIGURATION_PATCHREQUESTBODY_SECRET_SCANNING_PUSH_PROTECTION + default: + return 0, errors.New("Unknown WithConfiguration_PatchRequestBody_secret_scanning_push_protection value: " + v) + } + return &result, nil +} +func SerializeWithConfiguration_PatchRequestBody_secret_scanning_push_protection(values []WithConfiguration_PatchRequestBody_secret_scanning_push_protection) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} +func (i WithConfiguration_PatchRequestBody_secret_scanning_push_protection) isMultiValue() bool { + return false +} diff --git a/pkg/github/orgs/item_code_security_configurations_defaults_request_builder.go b/pkg/github/orgs/item_code_security_configurations_defaults_request_builder.go new file mode 100644 index 00000000..9d409b2d --- /dev/null +++ b/pkg/github/orgs/item_code_security_configurations_defaults_request_builder.go @@ -0,0 +1,66 @@ +package orgs + +import ( + "context" + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6 "github.com/octokit/go-sdk/pkg/github/models" +) + +// ItemCodeSecurityConfigurationsDefaultsRequestBuilder builds and executes requests for operations under \orgs\{org}\code-security\configurations\defaults +type ItemCodeSecurityConfigurationsDefaultsRequestBuilder struct { + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder +} +// NewItemCodeSecurityConfigurationsDefaultsRequestBuilderInternal instantiates a new ItemCodeSecurityConfigurationsDefaultsRequestBuilder and sets the default values. +func NewItemCodeSecurityConfigurationsDefaultsRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCodeSecurityConfigurationsDefaultsRequestBuilder) { + m := &ItemCodeSecurityConfigurationsDefaultsRequestBuilder{ + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/orgs/{org}/code-security/configurations/defaults", pathParameters), + } + return m +} +// NewItemCodeSecurityConfigurationsDefaultsRequestBuilder instantiates a new ItemCodeSecurityConfigurationsDefaultsRequestBuilder and sets the default values. +func NewItemCodeSecurityConfigurationsDefaultsRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCodeSecurityConfigurationsDefaultsRequestBuilder) { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemCodeSecurityConfigurationsDefaultsRequestBuilderInternal(urlParams, requestAdapter) +} +// Get lists the default code security configurations for an organization.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +// returns a []CodeSecurityDefaultConfigurationsable when successful +// returns a BasicError error when the service returns a 403 status code +// returns a BasicError error when the service returns a 404 status code +// [API method documentation] +// +// [API method documentation]: https://docs.github.com/rest/code-security/configurations#get-default-code-security-configurations +func (m *ItemCodeSecurityConfigurationsDefaultsRequestBuilder) Get(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])([]i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityDefaultConfigurationsable, error) { + requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration); + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings { + "403": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "404": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + } + res, err := m.BaseRequestBuilder.RequestAdapter.SendCollection(ctx, requestInfo, i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateCodeSecurityDefaultConfigurationsFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + val := make([]i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityDefaultConfigurationsable, len(res)) + for i, v := range res { + if v != nil { + val[i] = v.(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityDefaultConfigurationsable) + } + } + return val, nil +} +// ToGetRequestInformation lists the default code security configurations for an organization.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +// returns a *RequestInformation when successful +func (m *ItemCodeSecurityConfigurationsDefaultsRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ConfigureRequestInformation(requestInfo, requestConfiguration) + requestInfo.Headers.TryAdd("Accept", "application/json") + return requestInfo, nil +} +// WithUrl returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. +// returns a *ItemCodeSecurityConfigurationsDefaultsRequestBuilder when successful +func (m *ItemCodeSecurityConfigurationsDefaultsRequestBuilder) WithUrl(rawUrl string)(*ItemCodeSecurityConfigurationsDefaultsRequestBuilder) { + return NewItemCodeSecurityConfigurationsDefaultsRequestBuilder(rawUrl, m.BaseRequestBuilder.RequestAdapter); +} diff --git a/pkg/github/orgs/item_code_security_configurations_item_attach_post_request_body.go b/pkg/github/orgs/item_code_security_configurations_item_attach_post_request_body.go new file mode 100644 index 00000000..717e320e --- /dev/null +++ b/pkg/github/orgs/item_code_security_configurations_item_attach_post_request_body.go @@ -0,0 +1,67 @@ +package orgs + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +type ItemCodeSecurityConfigurationsItemAttachPostRequestBody struct { + // An array of repository IDs to attach the configuration to. You can only provide a list of repository ids when the `scope` is set to `selected`. + selected_repository_ids []int32 +} +// NewItemCodeSecurityConfigurationsItemAttachPostRequestBody instantiates a new ItemCodeSecurityConfigurationsItemAttachPostRequestBody and sets the default values. +func NewItemCodeSecurityConfigurationsItemAttachPostRequestBody()(*ItemCodeSecurityConfigurationsItemAttachPostRequestBody) { + m := &ItemCodeSecurityConfigurationsItemAttachPostRequestBody{ + } + return m +} +// CreateItemCodeSecurityConfigurationsItemAttachPostRequestBodyFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +// returns a Parsable when successful +func CreateItemCodeSecurityConfigurationsItemAttachPostRequestBodyFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewItemCodeSecurityConfigurationsItemAttachPostRequestBody(), nil +} +// GetFieldDeserializers the deserialization information for the current model +// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful +func (m *ItemCodeSecurityConfigurationsItemAttachPostRequestBody) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) + res["selected_repository_ids"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfPrimitiveValues("int32") + if err != nil { + return err + } + if val != nil { + res := make([]int32, len(val)) + for i, v := range val { + if v != nil { + res[i] = *(v.(*int32)) + } + } + m.SetSelectedRepositoryIds(res) + } + return nil + } + return res +} +// GetSelectedRepositoryIds gets the selected_repository_ids property value. An array of repository IDs to attach the configuration to. You can only provide a list of repository ids when the `scope` is set to `selected`. +// returns a []int32 when successful +func (m *ItemCodeSecurityConfigurationsItemAttachPostRequestBody) GetSelectedRepositoryIds()([]int32) { + return m.selected_repository_ids +} +// Serialize serializes information the current object +func (m *ItemCodeSecurityConfigurationsItemAttachPostRequestBody) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + if m.GetSelectedRepositoryIds() != nil { + err := writer.WriteCollectionOfInt32Values("selected_repository_ids", m.GetSelectedRepositoryIds()) + if err != nil { + return err + } + } + return nil +} +// SetSelectedRepositoryIds sets the selected_repository_ids property value. An array of repository IDs to attach the configuration to. You can only provide a list of repository ids when the `scope` is set to `selected`. +func (m *ItemCodeSecurityConfigurationsItemAttachPostRequestBody) SetSelectedRepositoryIds(value []int32)() { + m.selected_repository_ids = value +} +type ItemCodeSecurityConfigurationsItemAttachPostRequestBodyable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetSelectedRepositoryIds()([]int32) + SetSelectedRepositoryIds(value []int32)() +} diff --git a/pkg/github/orgs/item_code_security_configurations_item_attach_post_response.go b/pkg/github/orgs/item_code_security_configurations_item_attach_post_response.go new file mode 100644 index 00000000..1305df28 --- /dev/null +++ b/pkg/github/orgs/item_code_security_configurations_item_attach_post_response.go @@ -0,0 +1,51 @@ +package orgs + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +type ItemCodeSecurityConfigurationsItemAttachPostResponse struct { + // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additionalData map[string]any +} +// NewItemCodeSecurityConfigurationsItemAttachPostResponse instantiates a new ItemCodeSecurityConfigurationsItemAttachPostResponse and sets the default values. +func NewItemCodeSecurityConfigurationsItemAttachPostResponse()(*ItemCodeSecurityConfigurationsItemAttachPostResponse) { + m := &ItemCodeSecurityConfigurationsItemAttachPostResponse{ + } + m.SetAdditionalData(make(map[string]any)) + return m +} +// CreateItemCodeSecurityConfigurationsItemAttachPostResponseFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +// returns a Parsable when successful +func CreateItemCodeSecurityConfigurationsItemAttachPostResponseFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewItemCodeSecurityConfigurationsItemAttachPostResponse(), nil +} +// GetAdditionalData gets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +// returns a map[string]any when successful +func (m *ItemCodeSecurityConfigurationsItemAttachPostResponse) GetAdditionalData()(map[string]any) { + return m.additionalData +} +// GetFieldDeserializers the deserialization information for the current model +// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful +func (m *ItemCodeSecurityConfigurationsItemAttachPostResponse) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) + return res +} +// Serialize serializes information the current object +func (m *ItemCodeSecurityConfigurationsItemAttachPostResponse) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + { + err := writer.WriteAdditionalData(m.GetAdditionalData()) + if err != nil { + return err + } + } + return nil +} +// SetAdditionalData sets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *ItemCodeSecurityConfigurationsItemAttachPostResponse) SetAdditionalData(value map[string]any)() { + m.additionalData = value +} +type ItemCodeSecurityConfigurationsItemAttachPostResponseable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable +} diff --git a/pkg/github/orgs/item_code_security_configurations_item_attach_request_builder.go b/pkg/github/orgs/item_code_security_configurations_item_attach_request_builder.go new file mode 100644 index 00000000..3ce9b00d --- /dev/null +++ b/pkg/github/orgs/item_code_security_configurations_item_attach_request_builder.go @@ -0,0 +1,60 @@ +package orgs + +import ( + "context" + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" +) + +// ItemCodeSecurityConfigurationsItemAttachRequestBuilder builds and executes requests for operations under \orgs\{org}\code-security\configurations\{configuration_id}\attach +type ItemCodeSecurityConfigurationsItemAttachRequestBuilder struct { + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder +} +// NewItemCodeSecurityConfigurationsItemAttachRequestBuilderInternal instantiates a new ItemCodeSecurityConfigurationsItemAttachRequestBuilder and sets the default values. +func NewItemCodeSecurityConfigurationsItemAttachRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCodeSecurityConfigurationsItemAttachRequestBuilder) { + m := &ItemCodeSecurityConfigurationsItemAttachRequestBuilder{ + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/orgs/{org}/code-security/configurations/{configuration_id}/attach", pathParameters), + } + return m +} +// NewItemCodeSecurityConfigurationsItemAttachRequestBuilder instantiates a new ItemCodeSecurityConfigurationsItemAttachRequestBuilder and sets the default values. +func NewItemCodeSecurityConfigurationsItemAttachRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCodeSecurityConfigurationsItemAttachRequestBuilder) { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemCodeSecurityConfigurationsItemAttachRequestBuilderInternal(urlParams, requestAdapter) +} +// Post attach a code security configuration to a set of repositories. If the repositories specified are already attached to a configuration, they will be re-attached to the provided configuration.If insufficient GHAS licenses are available to attach the configuration to a repository, only free features will be enabled.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +// returns a ItemCodeSecurityConfigurationsItemAttachPostResponseable when successful +// [API method documentation] +// +// [API method documentation]: https://docs.github.com/rest/code-security/configurations#attach-a-configuration-to-repositories +func (m *ItemCodeSecurityConfigurationsItemAttachRequestBuilder) Post(ctx context.Context, body ItemCodeSecurityConfigurationsItemAttachPostRequestBodyable, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(ItemCodeSecurityConfigurationsItemAttachPostResponseable, error) { + requestInfo, err := m.ToPostRequestInformation(ctx, body, requestConfiguration); + if err != nil { + return nil, err + } + res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, CreateItemCodeSecurityConfigurationsItemAttachPostResponseFromDiscriminatorValue, nil) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ItemCodeSecurityConfigurationsItemAttachPostResponseable), nil +} +// ToPostRequestInformation attach a code security configuration to a set of repositories. If the repositories specified are already attached to a configuration, they will be re-attached to the provided configuration.If insufficient GHAS licenses are available to attach the configuration to a repository, only free features will be enabled.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +// returns a *RequestInformation when successful +func (m *ItemCodeSecurityConfigurationsItemAttachRequestBuilder) ToPostRequestInformation(ctx context.Context, body ItemCodeSecurityConfigurationsItemAttachPostRequestBodyable, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ConfigureRequestInformation(requestInfo, requestConfiguration) + requestInfo.Headers.TryAdd("Accept", "application/json") + err := requestInfo.SetContentFromParsable(ctx, m.BaseRequestBuilder.RequestAdapter, "application/json", body) + if err != nil { + return nil, err + } + return requestInfo, nil +} +// WithUrl returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. +// returns a *ItemCodeSecurityConfigurationsItemAttachRequestBuilder when successful +func (m *ItemCodeSecurityConfigurationsItemAttachRequestBuilder) WithUrl(rawUrl string)(*ItemCodeSecurityConfigurationsItemAttachRequestBuilder) { + return NewItemCodeSecurityConfigurationsItemAttachRequestBuilder(rawUrl, m.BaseRequestBuilder.RequestAdapter); +} diff --git a/pkg/github/orgs/item_code_security_configurations_item_defaults_put_request_body.go b/pkg/github/orgs/item_code_security_configurations_item_defaults_put_request_body.go new file mode 100644 index 00000000..c08f646d --- /dev/null +++ b/pkg/github/orgs/item_code_security_configurations_item_defaults_put_request_body.go @@ -0,0 +1,51 @@ +package orgs + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +type ItemCodeSecurityConfigurationsItemDefaultsPutRequestBody struct { + // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additionalData map[string]any +} +// NewItemCodeSecurityConfigurationsItemDefaultsPutRequestBody instantiates a new ItemCodeSecurityConfigurationsItemDefaultsPutRequestBody and sets the default values. +func NewItemCodeSecurityConfigurationsItemDefaultsPutRequestBody()(*ItemCodeSecurityConfigurationsItemDefaultsPutRequestBody) { + m := &ItemCodeSecurityConfigurationsItemDefaultsPutRequestBody{ + } + m.SetAdditionalData(make(map[string]any)) + return m +} +// CreateItemCodeSecurityConfigurationsItemDefaultsPutRequestBodyFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +// returns a Parsable when successful +func CreateItemCodeSecurityConfigurationsItemDefaultsPutRequestBodyFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewItemCodeSecurityConfigurationsItemDefaultsPutRequestBody(), nil +} +// GetAdditionalData gets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +// returns a map[string]any when successful +func (m *ItemCodeSecurityConfigurationsItemDefaultsPutRequestBody) GetAdditionalData()(map[string]any) { + return m.additionalData +} +// GetFieldDeserializers the deserialization information for the current model +// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful +func (m *ItemCodeSecurityConfigurationsItemDefaultsPutRequestBody) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) + return res +} +// Serialize serializes information the current object +func (m *ItemCodeSecurityConfigurationsItemDefaultsPutRequestBody) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + { + err := writer.WriteAdditionalData(m.GetAdditionalData()) + if err != nil { + return err + } + } + return nil +} +// SetAdditionalData sets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *ItemCodeSecurityConfigurationsItemDefaultsPutRequestBody) SetAdditionalData(value map[string]any)() { + m.additionalData = value +} +type ItemCodeSecurityConfigurationsItemDefaultsPutRequestBodyable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable +} diff --git a/pkg/github/orgs/item_code_security_configurations_item_defaults_put_response.go b/pkg/github/orgs/item_code_security_configurations_item_defaults_put_response.go new file mode 100644 index 00000000..aa385edd --- /dev/null +++ b/pkg/github/orgs/item_code_security_configurations_item_defaults_put_response.go @@ -0,0 +1,81 @@ +package orgs + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6 "github.com/octokit/go-sdk/pkg/github/models" +) + +type ItemCodeSecurityConfigurationsItemDefaultsPutResponse struct { + // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additionalData map[string]any + // A code security configuration + configuration i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityConfigurationable +} +// NewItemCodeSecurityConfigurationsItemDefaultsPutResponse instantiates a new ItemCodeSecurityConfigurationsItemDefaultsPutResponse and sets the default values. +func NewItemCodeSecurityConfigurationsItemDefaultsPutResponse()(*ItemCodeSecurityConfigurationsItemDefaultsPutResponse) { + m := &ItemCodeSecurityConfigurationsItemDefaultsPutResponse{ + } + m.SetAdditionalData(make(map[string]any)) + return m +} +// CreateItemCodeSecurityConfigurationsItemDefaultsPutResponseFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +// returns a Parsable when successful +func CreateItemCodeSecurityConfigurationsItemDefaultsPutResponseFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewItemCodeSecurityConfigurationsItemDefaultsPutResponse(), nil +} +// GetAdditionalData gets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +// returns a map[string]any when successful +func (m *ItemCodeSecurityConfigurationsItemDefaultsPutResponse) GetAdditionalData()(map[string]any) { + return m.additionalData +} +// GetConfiguration gets the configuration property value. A code security configuration +// returns a CodeSecurityConfigurationable when successful +func (m *ItemCodeSecurityConfigurationsItemDefaultsPutResponse) GetConfiguration()(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityConfigurationable) { + return m.configuration +} +// GetFieldDeserializers the deserialization information for the current model +// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful +func (m *ItemCodeSecurityConfigurationsItemDefaultsPutResponse) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) + res["configuration"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateCodeSecurityConfigurationFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetConfiguration(val.(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityConfigurationable)) + } + return nil + } + return res +} +// Serialize serializes information the current object +func (m *ItemCodeSecurityConfigurationsItemDefaultsPutResponse) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + { + err := writer.WriteObjectValue("configuration", m.GetConfiguration()) + if err != nil { + return err + } + } + { + err := writer.WriteAdditionalData(m.GetAdditionalData()) + if err != nil { + return err + } + } + return nil +} +// SetAdditionalData sets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *ItemCodeSecurityConfigurationsItemDefaultsPutResponse) SetAdditionalData(value map[string]any)() { + m.additionalData = value +} +// SetConfiguration sets the configuration property value. A code security configuration +func (m *ItemCodeSecurityConfigurationsItemDefaultsPutResponse) SetConfiguration(value i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityConfigurationable)() { + m.configuration = value +} +type ItemCodeSecurityConfigurationsItemDefaultsPutResponseable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetConfiguration()(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityConfigurationable) + SetConfiguration(value i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityConfigurationable)() +} diff --git a/pkg/github/orgs/item_code_security_configurations_item_defaults_request_builder.go b/pkg/github/orgs/item_code_security_configurations_item_defaults_request_builder.go new file mode 100644 index 00000000..54a5bd2f --- /dev/null +++ b/pkg/github/orgs/item_code_security_configurations_item_defaults_request_builder.go @@ -0,0 +1,67 @@ +package orgs + +import ( + "context" + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6 "github.com/octokit/go-sdk/pkg/github/models" +) + +// ItemCodeSecurityConfigurationsItemDefaultsRequestBuilder builds and executes requests for operations under \orgs\{org}\code-security\configurations\{configuration_id}\defaults +type ItemCodeSecurityConfigurationsItemDefaultsRequestBuilder struct { + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder +} +// NewItemCodeSecurityConfigurationsItemDefaultsRequestBuilderInternal instantiates a new ItemCodeSecurityConfigurationsItemDefaultsRequestBuilder and sets the default values. +func NewItemCodeSecurityConfigurationsItemDefaultsRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCodeSecurityConfigurationsItemDefaultsRequestBuilder) { + m := &ItemCodeSecurityConfigurationsItemDefaultsRequestBuilder{ + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/orgs/{org}/code-security/configurations/{configuration_id}/defaults", pathParameters), + } + return m +} +// NewItemCodeSecurityConfigurationsItemDefaultsRequestBuilder instantiates a new ItemCodeSecurityConfigurationsItemDefaultsRequestBuilder and sets the default values. +func NewItemCodeSecurityConfigurationsItemDefaultsRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCodeSecurityConfigurationsItemDefaultsRequestBuilder) { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemCodeSecurityConfigurationsItemDefaultsRequestBuilderInternal(urlParams, requestAdapter) +} +// Put sets a code security configuration as a default to be applied to new repositories in your organization.This configuration will be applied to the matching repository type (all, none, public, private and internal) by default when they are created.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +// returns a ItemCodeSecurityConfigurationsItemDefaultsPutResponseable when successful +// returns a BasicError error when the service returns a 403 status code +// returns a BasicError error when the service returns a 404 status code +// [API method documentation] +// +// [API method documentation]: https://docs.github.com/rest/code-security/configurations#set-a-code-security-configuration-as-a-default-for-an-organization +func (m *ItemCodeSecurityConfigurationsItemDefaultsRequestBuilder) Put(ctx context.Context, body ItemCodeSecurityConfigurationsItemDefaultsPutRequestBodyable, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(ItemCodeSecurityConfigurationsItemDefaultsPutResponseable, error) { + requestInfo, err := m.ToPutRequestInformation(ctx, body, requestConfiguration); + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings { + "403": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "404": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + } + res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, CreateItemCodeSecurityConfigurationsItemDefaultsPutResponseFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ItemCodeSecurityConfigurationsItemDefaultsPutResponseable), nil +} +// ToPutRequestInformation sets a code security configuration as a default to be applied to new repositories in your organization.This configuration will be applied to the matching repository type (all, none, public, private and internal) by default when they are created.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +// returns a *RequestInformation when successful +func (m *ItemCodeSecurityConfigurationsItemDefaultsRequestBuilder) ToPutRequestInformation(ctx context.Context, body ItemCodeSecurityConfigurationsItemDefaultsPutRequestBodyable, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.PUT, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ConfigureRequestInformation(requestInfo, requestConfiguration) + requestInfo.Headers.TryAdd("Accept", "application/json") + err := requestInfo.SetContentFromParsable(ctx, m.BaseRequestBuilder.RequestAdapter, "application/json", body) + if err != nil { + return nil, err + } + return requestInfo, nil +} +// WithUrl returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. +// returns a *ItemCodeSecurityConfigurationsItemDefaultsRequestBuilder when successful +func (m *ItemCodeSecurityConfigurationsItemDefaultsRequestBuilder) WithUrl(rawUrl string)(*ItemCodeSecurityConfigurationsItemDefaultsRequestBuilder) { + return NewItemCodeSecurityConfigurationsItemDefaultsRequestBuilder(rawUrl, m.BaseRequestBuilder.RequestAdapter); +} diff --git a/pkg/github/orgs/item_code_security_configurations_item_repositories_request_builder.go b/pkg/github/orgs/item_code_security_configurations_item_repositories_request_builder.go new file mode 100644 index 00000000..e34a6bf9 --- /dev/null +++ b/pkg/github/orgs/item_code_security_configurations_item_repositories_request_builder.go @@ -0,0 +1,77 @@ +package orgs + +import ( + "context" + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6 "github.com/octokit/go-sdk/pkg/github/models" +) + +// ItemCodeSecurityConfigurationsItemRepositoriesRequestBuilder builds and executes requests for operations under \orgs\{org}\code-security\configurations\{configuration_id}\repositories +type ItemCodeSecurityConfigurationsItemRepositoriesRequestBuilder struct { + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder +} +// ItemCodeSecurityConfigurationsItemRepositoriesRequestBuilderGetQueryParameters lists the repositories associated with a code security configuration in an organization.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +type ItemCodeSecurityConfigurationsItemRepositoriesRequestBuilderGetQueryParameters struct { + // A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results after this cursor. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." + After *string `uriparametername:"after"` + // A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results before this cursor. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." + Before *string `uriparametername:"before"` + // The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." + Per_page *int32 `uriparametername:"per_page"` + // A comma-separated list of statuses. If specified, only repositories with these attachment statuses will be returned.Can be: `all`, `attached`, `attaching`, `detached`, `enforced`, `failed`, `updating` + Status *string `uriparametername:"status"` +} +// NewItemCodeSecurityConfigurationsItemRepositoriesRequestBuilderInternal instantiates a new ItemCodeSecurityConfigurationsItemRepositoriesRequestBuilder and sets the default values. +func NewItemCodeSecurityConfigurationsItemRepositoriesRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCodeSecurityConfigurationsItemRepositoriesRequestBuilder) { + m := &ItemCodeSecurityConfigurationsItemRepositoriesRequestBuilder{ + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/orgs/{org}/code-security/configurations/{configuration_id}/repositories{?after*,before*,per_page*,status*}", pathParameters), + } + return m +} +// NewItemCodeSecurityConfigurationsItemRepositoriesRequestBuilder instantiates a new ItemCodeSecurityConfigurationsItemRepositoriesRequestBuilder and sets the default values. +func NewItemCodeSecurityConfigurationsItemRepositoriesRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCodeSecurityConfigurationsItemRepositoriesRequestBuilder) { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemCodeSecurityConfigurationsItemRepositoriesRequestBuilderInternal(urlParams, requestAdapter) +} +// Get lists the repositories associated with a code security configuration in an organization.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +// returns a []CodeSecurityConfigurationRepositoriesable when successful +// returns a BasicError error when the service returns a 403 status code +// returns a BasicError error when the service returns a 404 status code +// [API method documentation] +// +// [API method documentation]: https://docs.github.com/rest/code-security/configurations#get-repositories-associated-with-a-code-security-configuration +func (m *ItemCodeSecurityConfigurationsItemRepositoriesRequestBuilder) Get(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[ItemCodeSecurityConfigurationsItemRepositoriesRequestBuilderGetQueryParameters])([]i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityConfigurationRepositoriesable, error) { + requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration); + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings { + "403": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "404": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + } + res, err := m.BaseRequestBuilder.RequestAdapter.SendCollection(ctx, requestInfo, i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateCodeSecurityConfigurationRepositoriesFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + val := make([]i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityConfigurationRepositoriesable, len(res)) + for i, v := range res { + if v != nil { + val[i] = v.(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityConfigurationRepositoriesable) + } + } + return val, nil +} +// ToGetRequestInformation lists the repositories associated with a code security configuration in an organization.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +// returns a *RequestInformation when successful +func (m *ItemCodeSecurityConfigurationsItemRepositoriesRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[ItemCodeSecurityConfigurationsItemRepositoriesRequestBuilderGetQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ConfigureRequestInformation(requestInfo, requestConfiguration) + requestInfo.Headers.TryAdd("Accept", "application/json") + return requestInfo, nil +} +// WithUrl returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. +// returns a *ItemCodeSecurityConfigurationsItemRepositoriesRequestBuilder when successful +func (m *ItemCodeSecurityConfigurationsItemRepositoriesRequestBuilder) WithUrl(rawUrl string)(*ItemCodeSecurityConfigurationsItemRepositoriesRequestBuilder) { + return NewItemCodeSecurityConfigurationsItemRepositoriesRequestBuilder(rawUrl, m.BaseRequestBuilder.RequestAdapter); +} diff --git a/pkg/github/orgs/item_code_security_configurations_item_with_configuration_patch_request_body.go b/pkg/github/orgs/item_code_security_configurations_item_with_configuration_patch_request_body.go new file mode 100644 index 00000000..e3740858 --- /dev/null +++ b/pkg/github/orgs/item_code_security_configurations_item_with_configuration_patch_request_body.go @@ -0,0 +1,90 @@ +package orgs + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +type ItemCodeSecurityConfigurationsItemWithConfiguration_PatchRequestBody struct { + // A description of the code security configuration + description *string + // The name of the code security configuration. Must be unique within the organization. + name *string +} +// NewItemCodeSecurityConfigurationsItemWithConfiguration_PatchRequestBody instantiates a new ItemCodeSecurityConfigurationsItemWithConfiguration_PatchRequestBody and sets the default values. +func NewItemCodeSecurityConfigurationsItemWithConfiguration_PatchRequestBody()(*ItemCodeSecurityConfigurationsItemWithConfiguration_PatchRequestBody) { + m := &ItemCodeSecurityConfigurationsItemWithConfiguration_PatchRequestBody{ + } + return m +} +// CreateItemCodeSecurityConfigurationsItemWithConfiguration_PatchRequestBodyFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +// returns a Parsable when successful +func CreateItemCodeSecurityConfigurationsItemWithConfiguration_PatchRequestBodyFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewItemCodeSecurityConfigurationsItemWithConfiguration_PatchRequestBody(), nil +} +// GetDescription gets the description property value. A description of the code security configuration +// returns a *string when successful +func (m *ItemCodeSecurityConfigurationsItemWithConfiguration_PatchRequestBody) GetDescription()(*string) { + return m.description +} +// GetFieldDeserializers the deserialization information for the current model +// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful +func (m *ItemCodeSecurityConfigurationsItemWithConfiguration_PatchRequestBody) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) + res["description"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetDescription(val) + } + return nil + } + res["name"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetName(val) + } + return nil + } + return res +} +// GetName gets the name property value. The name of the code security configuration. Must be unique within the organization. +// returns a *string when successful +func (m *ItemCodeSecurityConfigurationsItemWithConfiguration_PatchRequestBody) GetName()(*string) { + return m.name +} +// Serialize serializes information the current object +func (m *ItemCodeSecurityConfigurationsItemWithConfiguration_PatchRequestBody) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + { + err := writer.WriteStringValue("description", m.GetDescription()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("name", m.GetName()) + if err != nil { + return err + } + } + return nil +} +// SetDescription sets the description property value. A description of the code security configuration +func (m *ItemCodeSecurityConfigurationsItemWithConfiguration_PatchRequestBody) SetDescription(value *string)() { + m.description = value +} +// SetName sets the name property value. The name of the code security configuration. Must be unique within the organization. +func (m *ItemCodeSecurityConfigurationsItemWithConfiguration_PatchRequestBody) SetName(value *string)() { + m.name = value +} +type ItemCodeSecurityConfigurationsItemWithConfiguration_PatchRequestBodyable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetDescription()(*string) + GetName()(*string) + SetDescription(value *string)() + SetName(value *string)() +} diff --git a/pkg/github/orgs/item_code_security_configurations_post_request_body.go b/pkg/github/orgs/item_code_security_configurations_post_request_body.go new file mode 100644 index 00000000..b2356378 --- /dev/null +++ b/pkg/github/orgs/item_code_security_configurations_post_request_body.go @@ -0,0 +1,90 @@ +package orgs + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +type ItemCodeSecurityConfigurationsPostRequestBody struct { + // A description of the code security configuration + description *string + // The name of the code security configuration. Must be unique within the organization. + name *string +} +// NewItemCodeSecurityConfigurationsPostRequestBody instantiates a new ItemCodeSecurityConfigurationsPostRequestBody and sets the default values. +func NewItemCodeSecurityConfigurationsPostRequestBody()(*ItemCodeSecurityConfigurationsPostRequestBody) { + m := &ItemCodeSecurityConfigurationsPostRequestBody{ + } + return m +} +// CreateItemCodeSecurityConfigurationsPostRequestBodyFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +// returns a Parsable when successful +func CreateItemCodeSecurityConfigurationsPostRequestBodyFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewItemCodeSecurityConfigurationsPostRequestBody(), nil +} +// GetDescription gets the description property value. A description of the code security configuration +// returns a *string when successful +func (m *ItemCodeSecurityConfigurationsPostRequestBody) GetDescription()(*string) { + return m.description +} +// GetFieldDeserializers the deserialization information for the current model +// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful +func (m *ItemCodeSecurityConfigurationsPostRequestBody) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) + res["description"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetDescription(val) + } + return nil + } + res["name"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetName(val) + } + return nil + } + return res +} +// GetName gets the name property value. The name of the code security configuration. Must be unique within the organization. +// returns a *string when successful +func (m *ItemCodeSecurityConfigurationsPostRequestBody) GetName()(*string) { + return m.name +} +// Serialize serializes information the current object +func (m *ItemCodeSecurityConfigurationsPostRequestBody) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + { + err := writer.WriteStringValue("description", m.GetDescription()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("name", m.GetName()) + if err != nil { + return err + } + } + return nil +} +// SetDescription sets the description property value. A description of the code security configuration +func (m *ItemCodeSecurityConfigurationsPostRequestBody) SetDescription(value *string)() { + m.description = value +} +// SetName sets the name property value. The name of the code security configuration. Must be unique within the organization. +func (m *ItemCodeSecurityConfigurationsPostRequestBody) SetName(value *string)() { + m.name = value +} +type ItemCodeSecurityConfigurationsPostRequestBodyable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetDescription()(*string) + GetName()(*string) + SetDescription(value *string)() + SetName(value *string)() +} diff --git a/pkg/github/orgs/item_code_security_configurations_request_builder.go b/pkg/github/orgs/item_code_security_configurations_request_builder.go new file mode 100644 index 00000000..c29cbb00 --- /dev/null +++ b/pkg/github/orgs/item_code_security_configurations_request_builder.go @@ -0,0 +1,125 @@ +package orgs + +import ( + "context" + i53ac87e8cb3cc9276228f74d38694a208cacb99bb8ceb705eeae99fb88d4d274 "strconv" + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6 "github.com/octokit/go-sdk/pkg/github/models" + i52d196ba31fe242a3b1c122ebea75dc29b66835834cf12c73d3ed455433c35e8 "github.com/octokit/go-sdk/pkg/github/orgs/item/codesecurity/configurations" +) + +// ItemCodeSecurityConfigurationsRequestBuilder builds and executes requests for operations under \orgs\{org}\code-security\configurations +type ItemCodeSecurityConfigurationsRequestBuilder struct { + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder +} +// ItemCodeSecurityConfigurationsRequestBuilderGetQueryParameters lists all code security configurations available in an organization.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +type ItemCodeSecurityConfigurationsRequestBuilderGetQueryParameters struct { + // A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results after this cursor. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." + After *string `uriparametername:"after"` + // A cursor, as given in the [Link header](https://docs.github.com/rest/guides/using-pagination-in-the-rest-api#using-link-headers). If specified, the query only searches for results before this cursor. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." + Before *string `uriparametername:"before"` + // 'The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."' + Per_page *int32 `uriparametername:"per_page"` + // The target type of the code security configuration + Target_type *i52d196ba31fe242a3b1c122ebea75dc29b66835834cf12c73d3ed455433c35e8.GetTarget_typeQueryParameterType `uriparametername:"target_type"` +} +// ByConfiguration_id gets an item from the github.com/octokit/go-sdk/pkg/github.orgs.item.codeSecurity.configurations.item collection +// returns a *ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder when successful +func (m *ItemCodeSecurityConfigurationsRequestBuilder) ByConfiguration_id(configuration_id int32)(*ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder) { + urlTplParams := make(map[string]string) + for idx, item := range m.BaseRequestBuilder.PathParameters { + urlTplParams[idx] = item + } + urlTplParams["configuration_id"] = i53ac87e8cb3cc9276228f74d38694a208cacb99bb8ceb705eeae99fb88d4d274.FormatInt(int64(configuration_id), 10) + return NewItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilderInternal(urlTplParams, m.BaseRequestBuilder.RequestAdapter) +} +// NewItemCodeSecurityConfigurationsRequestBuilderInternal instantiates a new ItemCodeSecurityConfigurationsRequestBuilder and sets the default values. +func NewItemCodeSecurityConfigurationsRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCodeSecurityConfigurationsRequestBuilder) { + m := &ItemCodeSecurityConfigurationsRequestBuilder{ + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/orgs/{org}/code-security/configurations{?after*,before*,per_page*,target_type*}", pathParameters), + } + return m +} +// NewItemCodeSecurityConfigurationsRequestBuilder instantiates a new ItemCodeSecurityConfigurationsRequestBuilder and sets the default values. +func NewItemCodeSecurityConfigurationsRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCodeSecurityConfigurationsRequestBuilder) { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemCodeSecurityConfigurationsRequestBuilderInternal(urlParams, requestAdapter) +} +// Defaults the defaults property +// returns a *ItemCodeSecurityConfigurationsDefaultsRequestBuilder when successful +func (m *ItemCodeSecurityConfigurationsRequestBuilder) Defaults()(*ItemCodeSecurityConfigurationsDefaultsRequestBuilder) { + return NewItemCodeSecurityConfigurationsDefaultsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) +} +// Get lists all code security configurations available in an organization.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +// returns a []CodeSecurityConfigurationable when successful +// returns a BasicError error when the service returns a 403 status code +// returns a BasicError error when the service returns a 404 status code +// [API method documentation] +// +// [API method documentation]: https://docs.github.com/rest/code-security/configurations#get-code-security-configurations-for-an-organization +func (m *ItemCodeSecurityConfigurationsRequestBuilder) Get(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[ItemCodeSecurityConfigurationsRequestBuilderGetQueryParameters])([]i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityConfigurationable, error) { + requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration); + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings { + "403": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "404": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + } + res, err := m.BaseRequestBuilder.RequestAdapter.SendCollection(ctx, requestInfo, i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateCodeSecurityConfigurationFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + val := make([]i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityConfigurationable, len(res)) + for i, v := range res { + if v != nil { + val[i] = v.(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityConfigurationable) + } + } + return val, nil +} +// Post creates a code security configuration in an organization.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +// returns a CodeSecurityConfigurationable when successful +// [API method documentation] +// +// [API method documentation]: https://docs.github.com/rest/code-security/configurations#create-a-code-security-configuration +func (m *ItemCodeSecurityConfigurationsRequestBuilder) Post(ctx context.Context, body ItemCodeSecurityConfigurationsPostRequestBodyable, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityConfigurationable, error) { + requestInfo, err := m.ToPostRequestInformation(ctx, body, requestConfiguration); + if err != nil { + return nil, err + } + res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateCodeSecurityConfigurationFromDiscriminatorValue, nil) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityConfigurationable), nil +} +// ToGetRequestInformation lists all code security configurations available in an organization.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +// returns a *RequestInformation when successful +func (m *ItemCodeSecurityConfigurationsRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[ItemCodeSecurityConfigurationsRequestBuilderGetQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ConfigureRequestInformation(requestInfo, requestConfiguration) + requestInfo.Headers.TryAdd("Accept", "application/json") + return requestInfo, nil +} +// ToPostRequestInformation creates a code security configuration in an organization.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +// returns a *RequestInformation when successful +func (m *ItemCodeSecurityConfigurationsRequestBuilder) ToPostRequestInformation(ctx context.Context, body ItemCodeSecurityConfigurationsPostRequestBodyable, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ConfigureRequestInformation(requestInfo, requestConfiguration) + requestInfo.Headers.TryAdd("Accept", "application/json") + err := requestInfo.SetContentFromParsable(ctx, m.BaseRequestBuilder.RequestAdapter, "application/json", body) + if err != nil { + return nil, err + } + return requestInfo, nil +} +// WithUrl returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. +// returns a *ItemCodeSecurityConfigurationsRequestBuilder when successful +func (m *ItemCodeSecurityConfigurationsRequestBuilder) WithUrl(rawUrl string)(*ItemCodeSecurityConfigurationsRequestBuilder) { + return NewItemCodeSecurityConfigurationsRequestBuilder(rawUrl, m.BaseRequestBuilder.RequestAdapter); +} diff --git a/pkg/github/orgs/item_code_security_configurations_with_configuration_item_request_builder.go b/pkg/github/orgs/item_code_security_configurations_with_configuration_item_request_builder.go new file mode 100644 index 00000000..cf5adb82 --- /dev/null +++ b/pkg/github/orgs/item_code_security_configurations_with_configuration_item_request_builder.go @@ -0,0 +1,142 @@ +package orgs + +import ( + "context" + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6 "github.com/octokit/go-sdk/pkg/github/models" +) + +// ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder builds and executes requests for operations under \orgs\{org}\code-security\configurations\{configuration_id} +type ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder struct { + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder +} +// Attach the attach property +// returns a *ItemCodeSecurityConfigurationsItemAttachRequestBuilder when successful +func (m *ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder) Attach()(*ItemCodeSecurityConfigurationsItemAttachRequestBuilder) { + return NewItemCodeSecurityConfigurationsItemAttachRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) +} +// NewItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilderInternal instantiates a new ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder and sets the default values. +func NewItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder) { + m := &ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder{ + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/orgs/{org}/code-security/configurations/{configuration_id}", pathParameters), + } + return m +} +// NewItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder instantiates a new ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder and sets the default values. +func NewItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder) { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilderInternal(urlParams, requestAdapter) +} +// Defaults the defaults property +// returns a *ItemCodeSecurityConfigurationsItemDefaultsRequestBuilder when successful +func (m *ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder) Defaults()(*ItemCodeSecurityConfigurationsItemDefaultsRequestBuilder) { + return NewItemCodeSecurityConfigurationsItemDefaultsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) +} +// Delete deletes the desired code security configuration from an organization.Repositories attached to the configuration will retain their settings but will no longer be associated withthe configuration.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +// returns a BasicError error when the service returns a 400 status code +// returns a BasicError error when the service returns a 403 status code +// returns a BasicError error when the service returns a 404 status code +// returns a BasicError error when the service returns a 409 status code +// [API method documentation] +// +// [API method documentation]: https://docs.github.com/rest/code-security/configurations#delete-a-code-security-configuration +func (m *ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(error) { + requestInfo, err := m.ToDeleteRequestInformation(ctx, requestConfiguration); + if err != nil { + return err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings { + "400": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "403": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "404": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "409": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + } + err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping) + if err != nil { + return err + } + return nil +} +// Get gets a code security configuration available in an organization.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +// returns a CodeSecurityConfigurationable when successful +// returns a BasicError error when the service returns a 403 status code +// returns a BasicError error when the service returns a 404 status code +// [API method documentation] +// +// [API method documentation]: https://docs.github.com/rest/code-security/configurations#get-a-code-security-configuration +func (m *ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder) Get(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityConfigurationable, error) { + requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration); + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings { + "403": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "404": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + } + res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateCodeSecurityConfigurationFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityConfigurationable), nil +} +// Patch updates a code security configuration in an organization.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +// returns a CodeSecurityConfigurationable when successful +// [API method documentation] +// +// [API method documentation]: https://docs.github.com/rest/code-security/configurations#update-a-code-security-configuration +func (m *ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder) Patch(ctx context.Context, body ItemCodeSecurityConfigurationsItemWithConfiguration_PatchRequestBodyable, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityConfigurationable, error) { + requestInfo, err := m.ToPatchRequestInformation(ctx, body, requestConfiguration); + if err != nil { + return nil, err + } + res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateCodeSecurityConfigurationFromDiscriminatorValue, nil) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CodeSecurityConfigurationable), nil +} +// Repositories the repositories property +// returns a *ItemCodeSecurityConfigurationsItemRepositoriesRequestBuilder when successful +func (m *ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder) Repositories()(*ItemCodeSecurityConfigurationsItemRepositoriesRequestBuilder) { + return NewItemCodeSecurityConfigurationsItemRepositoriesRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) +} +// ToDeleteRequestInformation deletes the desired code security configuration from an organization.Repositories attached to the configuration will retain their settings but will no longer be associated withthe configuration.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +// returns a *RequestInformation when successful +func (m *ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder) ToDeleteRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DELETE, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ConfigureRequestInformation(requestInfo, requestConfiguration) + requestInfo.Headers.TryAdd("Accept", "application/json, application/scim+json") + return requestInfo, nil +} +// ToGetRequestInformation gets a code security configuration available in an organization.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +// returns a *RequestInformation when successful +func (m *ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ConfigureRequestInformation(requestInfo, requestConfiguration) + requestInfo.Headers.TryAdd("Accept", "application/json") + return requestInfo, nil +} +// ToPatchRequestInformation updates a code security configuration in an organization.The authenticated user must be an administrator or security manager for the organization to use this endpoint.OAuth app tokens and personal access tokens (classic) need the `write:org` scope to use this endpoint. +// returns a *RequestInformation when successful +func (m *ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder) ToPatchRequestInformation(ctx context.Context, body ItemCodeSecurityConfigurationsItemWithConfiguration_PatchRequestBodyable, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.PATCH, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ConfigureRequestInformation(requestInfo, requestConfiguration) + requestInfo.Headers.TryAdd("Accept", "application/json") + err := requestInfo.SetContentFromParsable(ctx, m.BaseRequestBuilder.RequestAdapter, "application/json", body) + if err != nil { + return nil, err + } + return requestInfo, nil +} +// WithUrl returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. +// returns a *ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder when successful +func (m *ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder) WithUrl(rawUrl string)(*ItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder) { + return NewItemCodeSecurityConfigurationsWithConfiguration_ItemRequestBuilder(rawUrl, m.BaseRequestBuilder.RequestAdapter); +} diff --git a/pkg/github/orgs/item_code_security_request_builder.go b/pkg/github/orgs/item_code_security_request_builder.go new file mode 100644 index 00000000..3cb8c9a4 --- /dev/null +++ b/pkg/github/orgs/item_code_security_request_builder.go @@ -0,0 +1,28 @@ +package orgs + +import ( + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" +) + +// ItemCodeSecurityRequestBuilder builds and executes requests for operations under \orgs\{org}\code-security +type ItemCodeSecurityRequestBuilder struct { + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder +} +// Configurations the configurations property +// returns a *ItemCodeSecurityConfigurationsRequestBuilder when successful +func (m *ItemCodeSecurityRequestBuilder) Configurations()(*ItemCodeSecurityConfigurationsRequestBuilder) { + return NewItemCodeSecurityConfigurationsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) +} +// NewItemCodeSecurityRequestBuilderInternal instantiates a new ItemCodeSecurityRequestBuilder and sets the default values. +func NewItemCodeSecurityRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCodeSecurityRequestBuilder) { + m := &ItemCodeSecurityRequestBuilder{ + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/orgs/{org}/code-security", pathParameters), + } + return m +} +// NewItemCodeSecurityRequestBuilder instantiates a new ItemCodeSecurityRequestBuilder and sets the default values. +func NewItemCodeSecurityRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCodeSecurityRequestBuilder) { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemCodeSecurityRequestBuilderInternal(urlParams, requestAdapter) +} diff --git a/pkg/github/orgs/with_org_item_request_builder.go b/pkg/github/orgs/with_org_item_request_builder.go index 905c4dbd..68556a44 100644 --- a/pkg/github/orgs/with_org_item_request_builder.go +++ b/pkg/github/orgs/with_org_item_request_builder.go @@ -37,6 +37,11 @@ func (m *WithOrgItemRequestBuilder) BySecurity_product(security_product string)( func (m *WithOrgItemRequestBuilder) CodeScanning()(*ItemCodeScanningRequestBuilder) { return NewItemCodeScanningRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) } +// CodeSecurity the codeSecurity property +// returns a *ItemCodeSecurityRequestBuilder when successful +func (m *WithOrgItemRequestBuilder) CodeSecurity()(*ItemCodeSecurityRequestBuilder) { + return NewItemCodeSecurityRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) +} // Codespaces the codespaces property // returns a *ItemCodespacesRequestBuilder when successful func (m *WithOrgItemRequestBuilder) Codespaces()(*ItemCodespacesRequestBuilder) {