Skip to content

feat: Add support for network-configurations endpoints #3497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
feat(network-configurations): Refactoring struct type and simplify fu…
…nction signature.
  • Loading branch information
jndz2 committed Mar 2, 2025
commit d9f8734d069d642e4c83f57370314cc16eb259dd
10 changes: 5 additions & 5 deletions github/enterprise_network_configurations.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type EnterpriseNetworkSettingsResource struct {
type EnterpriseNetworkConfigurationRequest struct {
Name *string `json:"name,omitempty"`
ComputeService *ComputeService `json:"compute_service,omitempty"`
NetworkSettingsIDs *[]string `json:"network_settings_ids,omitempty"`
NetworkSettingsIDs []string `json:"network_settings_ids,omitempty"`
}

// ListEnterpriseNetworkConfigurations lists all hosted compute network configurations configured in an enterprise.
Expand Down Expand Up @@ -100,7 +100,7 @@ func (s *EnterpriseService) CreateEnterpriseNetworkConfiguration(ctx context.Con
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations#get-a-hosted-compute-network-configuration-for-an-enterprise
//
//meta:operation GET /enterprises/{enterprise}/network-configurations/{network_configuration_id}
func (s *EnterpriseService) GetEnterpriseNetworkConfiguration(ctx context.Context, enterprise string, networkID string) (*EnterpriseNetworkConfiguration, *Response, error) {
func (s *EnterpriseService) GetEnterpriseNetworkConfiguration(ctx context.Context, enterprise, networkID string) (*EnterpriseNetworkConfiguration, *Response, error) {
u := fmt.Sprintf("enterprises/%v/network-configurations/%v", enterprise, networkID)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
Expand All @@ -120,7 +120,7 @@ func (s *EnterpriseService) GetEnterpriseNetworkConfiguration(ctx context.Contex
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations#update-a-hosted-compute-network-configuration-for-an-enterprise
//
//meta:operation PATCH /enterprises/{enterprise}/network-configurations/{network_configuration_id}
func (s *EnterpriseService) UpdateEnterpriseNetworkConfiguration(ctx context.Context, enterprise string, networkID string, updateReq EnterpriseNetworkConfigurationRequest) (*EnterpriseNetworkConfiguration, *Response, error) {
func (s *EnterpriseService) UpdateEnterpriseNetworkConfiguration(ctx context.Context, enterprise, networkID string, updateReq EnterpriseNetworkConfigurationRequest) (*EnterpriseNetworkConfiguration, *Response, error) {
u := fmt.Sprintf("enterprises/%v/network-configurations/%v", enterprise, networkID)
req, err := s.client.NewRequest("PATCH", u, updateReq)
if err != nil {
Expand All @@ -140,7 +140,7 @@ func (s *EnterpriseService) UpdateEnterpriseNetworkConfiguration(ctx context.Con
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations#delete-a-hosted-compute-network-configuration-from-an-enterprise
//
//meta:operation DELETE /enterprises/{enterprise}/network-configurations/{network_configuration_id}
func (s *EnterpriseService) DeleteEnterpriseNetworkConfiguration(ctx context.Context, enterprise string, networkID string) (*Response, error) {
func (s *EnterpriseService) DeleteEnterpriseNetworkConfiguration(ctx context.Context, enterprise, networkID string) (*Response, error) {
u := fmt.Sprintf("enterprises/%v/network-configurations/%v", enterprise, networkID)
req, err := s.client.NewRequest("DELETE", u, nil)
if err != nil {
Expand All @@ -154,7 +154,7 @@ func (s *EnterpriseService) DeleteEnterpriseNetworkConfiguration(ctx context.Con
// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations#get-a-hosted-compute-network-settings-resource-for-an-enterprise
//
//meta:operation GET /enterprises/{enterprise}/network-settings/{network_settings_id}
func (s *EnterpriseService) GetEnterpriseNetworkSettingsResource(ctx context.Context, enterprise string, networkID string) (*EnterpriseNetworkSettingsResource, *Response, error) {
func (s *EnterpriseService) GetEnterpriseNetworkSettingsResource(ctx context.Context, enterprise, networkID string) (*EnterpriseNetworkSettingsResource, *Response, error) {
u := fmt.Sprintf("enterprises/%v/network-settings/%v", enterprise, networkID)
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions github/enterprise_network_configurations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func TestEnterpriseService_CreateEnterpriseNetworkConfiguration(t *testing.T) {
req := EnterpriseNetworkConfigurationRequest{
Name: Ptr("configuration_one"),
ComputeService: Ptr(ComputeService("actions")),
NetworkSettingsIDs: &[]string{
NetworkSettingsIDs: []string{
"23456789ABDCEF1",
"3456789ABDCEF12",
},
Expand Down Expand Up @@ -225,7 +225,7 @@ func TestEnterpriseService_UpdateEnterpriseNetworkConfiguration(t *testing.T) {
ctx := context.Background()
req := EnterpriseNetworkConfigurationRequest{
Name: Ptr("updated_configuration_one"),
NetworkSettingsIDs: &[]string{
NetworkSettingsIDs: []string{
"456789ABDCEF123",
"56789ABDCEF1234",
},
Expand Down
8 changes: 0 additions & 8 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading