Repository: google/go-github
Pull request #3497 (2025-03-01 10:05:44)

feat: Add support for network-configurations endpoints
This pull request introduces support for the hosted compute network configurations  in the go-github library, addressing https://github.com/google/go-github/issues/3462.

Changes Include:

Implementation of API endpoints for managing network-configuration endpoints.
Support for the following operations:
* Get, Create, Update, Delete and List network-configuration of an enterprise.
* Get network settings resource.
* Corresponding unit tests for each function.

Additional Information:
API Reference: [GitHub REST API: Network Configurations](https://docs.github.com/en/enterprise-cloud@latest/rest/enterprise-admin/network-configurations?apiVersion=2022-11-28).

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/google/go-github/pull/3497?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 91.21%. Comparing base [(`868f897`)](https://app.codecov.io/gh/google/go-github/commit/868f897f6d9dcfc74bb954a092a51e6384d84b49?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) to head [(`41226b8`)](https://app.codecov.io/gh/google/go-github/commit/41226b8886eede79f0d844f6e8bf994dbc1ed7bd?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).
> Report is 6 commits behind head on master.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master    #3497      +/-   ##
==========================================
+ Coverage   91.02%   91.21%   +0.18%     
==========================================
  Files         179      182       +3     
  Lines       15561    15930     +369     
==========================================
+ Hits        14165    14531     +366     
- Misses       1223     1225       +2     
- Partials      173      174       +1     
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/google/go-github/pull/3497?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).

jndz2: All code suggestions fixed.
jndz2: Interesting the generate script ignores my type change from *[]string to []string. 

Do I also have to call the metadata script here, because of this warnings?

could not find operation "GET /enterprises/{enterprise}/network-configurations" in openapi_operations.yaml
could not find operation "POST /enterprises/{enterprise}/network-configurations" in openapi_operations.yaml
could not find operation "GET /enterprises/{enterprise}/network-configurations/{network_configuration_id}" in openapi_operations.yaml
could not find operation "PATCH /enterprises/{enterprise}/network-configurations/{network_configuration_id}" in openapi_operations.yaml
could not find operation "DELETE /enterprises/{enterprise}/network-configurations/{network_configuration_id}" in openapi_operations.yaml
could not find operation "GET /enterprises/{enterprise}/network-settings/{network_settings_id}" in openapi_operations.yaml
gmlewis: Hmmm... That's odd. Maybe we have a bug in our generators? 
I don't know and would have to dig in, but I'm currently on my phone. 
Please see if you can figure out what the problem is, and if you are still stuck, I can look later today.
jndz2: Okay, it seems like I'm stuck. When I run the tests, I don't get any errors, I have run all the scripts and only get the information “could not find operation”.
gmlewis: Sorry about that. It looks like we may have introduced a flaky test recently. Rerunning the jobs appears to have fixed it.

Patch:
diff --git a/github/enterprise_network_configurations.go b/github/enterprise_network_configurations.go
new file mode 100644
index 00000000..a5af390a
--- /dev/null
+++ b/github/enterprise_network_configurations.go
@@ -0,0 +1,170 @@
+// Copyright 2025 The go-github AUTHORS. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package github
+
+import (
+	"context"
+	"fmt"
+)
+
+// ComputeService represents a hosted compute service the network configuration supports.
+type ComputeService string
+
+const (
+	ComputeServiceNone    ComputeService = "none"
+	ComputeServiceActions ComputeService = "actions"
+)
+
+// EnterpriseNetworkConfiguration represents a hosted compute network configuration.
+type EnterpriseNetworkConfiguration struct {
+	ID                 *string         `json:"id,omitempty"`
+	Name               *string         `json:"name,omitempty"`
+	ComputeService     *ComputeService `json:"compute_service,omitempty"`
+	NetworkSettingsIDs []string        `json:"network_settings_ids,omitempty"`
+	CreatedOn          *Timestamp      `json:"created_on,omitempty"`
+}
+
+// EnterpriseNetworkConfigurations represents a hosted compute network configurations.
+type EnterpriseNetworkConfigurations struct {
+	TotalCount            *int64                            `json:"total_count,omitempty"`
+	NetworkConfigurations []*EnterpriseNetworkConfiguration `json:"network_configurations,omitempty"`
+}
+
+// EnterpriseNetworkSettingsResource represents a hosted compute network settings resource.
+type EnterpriseNetworkSettingsResource struct {
+	ID                     *string `json:"id,omitempty"`
+	Name                   *string `json:"name,omitempty"`
+	NetworkConfigurationID *string `json:"network_configuration_id,omitempty"`
+	SubnetID               *string `json:"subnet_id,omitempty"`
+	Region                 *string `json:"region,omitempty"`
+}
+
+// EnterpriseNetworkConfigurationRequest represents a request to create or update a network configuration for an enterprise.
+type EnterpriseNetworkConfigurationRequest struct {
+	Name               *string         `json:"name,omitempty"`
+	ComputeService     *ComputeService `json:"compute_service,omitempty"`
+	NetworkSettingsIDs []string        `json:"network_settings_ids,omitempty"`
+}
+
+// ListEnterpriseNetworkConfigurations lists all hosted compute network configurations configured in an enterprise.
+//
+// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations#list-hosted-compute-network-configurations-for-an-enterprise
+//
+//meta:operation GET /enterprises/{enterprise}/network-configurations
+func (s *EnterpriseService) ListEnterpriseNetworkConfigurations(ctx context.Context, enterprise string, opts *ListOptions) (*EnterpriseNetworkConfigurations, *Response, error) {
+	u := fmt.Sprintf("enterprises/%v/network-configurations", enterprise)
+	u, err := addOptions(u, opts)
+	if err != nil {
+		return nil, nil, err
+	}
+
+	req, err := s.client.NewRequest("GET", u, nil)
+	if err != nil {
+		return nil, nil, err
+	}
+
+	networks := &EnterpriseNetworkConfigurations{}
+	resp, err := s.client.Do(ctx, req, networks)
+	if err != nil {
+		return nil, resp, err
+	}
+	return networks, resp, nil
+}
+
+// CreateEnterpriseNetworkConfiguration creates a hosted compute network configuration for an enterprise.
+//
+// GitHub API docs: https://docs.github.com/enterprise-cloud@latest/rest/enterprise-admin/network-configurations#create-a-hosted-compute-network-configuration-for-an-enterprise
+//
+//meta:operation POST /enterprises/{enterprise}/network-configurations
+func (s *EnterpriseService) CreateEnterpriseNetworkConfiguration(ctx context.Context, enterprise string, createReq EnterpriseNetworkConfigurationRequest) (*EnterpriseNetworkConfiguration, *Response, error) {
+	u := fmt.Sprintf("enterprises/%v/network-configurations", enterprise)
+	req, err := s.client.NewRequest("POST", u, createReq)
+	if err != nil {
+		return nil, nil, err
+	}
+
+	network := &EnterpriseNetworkConfiguration{}
+	resp, err := s.client.Do(ctx, req, network)
+	if err != nil {
+		return nil, resp, err
+	}
+
+	return network, resp, nil
+}
+
+// GetEnterpriseNetworkConfiguration gets a hosted compute network configuration configured in an enterprise.
+//
+// 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, 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 {
+		return nil, nil, err
+	}
+
+	network := &EnterpriseNetworkConfiguration{}
+	resp, err := s.client.Do(ctx, req, network)
+	if err != nil {
+		return nil, resp, err
+	}
+	return network, resp, nil
+}
+
+// UpdateEnterpriseNetworkConfiguration updates a hosted compute network configuration for an enterprise.
+//
+// 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, 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 {
+		return nil, nil, err
+	}
+
+	network := &EnterpriseNetworkConfiguration{}
+	resp, err := s.client.Do(ctx, req, network)
+	if err != nil {
+		return nil, resp, err
+	}
+	return network, resp, nil
+}
+
+// DeleteEnterpriseNetworkConfiguration deletes a hosted compute network configuration from an enterprise.
+//
+// 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, 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 {
+		return nil, err
+	}
+	return s.client.Do(ctx, req, nil)
+}
+
+// GetEnterpriseNetworkSettingsResource gets a hosted compute network settings resource configured for an enterprise.
+//
+// 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, 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 {
+		return nil, nil, err
+	}
+
+	resource := &EnterpriseNetworkSettingsResource{}
+	resp, err := s.client.Do(ctx, req, resource)
+	if err != nil {
+		return nil, resp, err
+	}
+	return resource, resp, err
+}
diff --git a/github/github-accessors.go b/github/github-accessors.go
index 905dd80c..519f6cbb 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -8606,6 +8606,102 @@ func (e *Enterprise) GetWebsiteURL() string {
 	return *e.WebsiteURL
 }
 
+// GetComputeService returns the ComputeService field.
+func (e *EnterpriseNetworkConfiguration) GetComputeService() *ComputeService {
+	if e == nil {
+		return nil
+	}
+	return e.ComputeService
+}
+
+// GetCreatedOn returns the CreatedOn field if it's non-nil, zero value otherwise.
+func (e *EnterpriseNetworkConfiguration) GetCreatedOn() Timestamp {
+	if e == nil || e.CreatedOn == nil {
+		return Timestamp{}
+	}
+	return *e.CreatedOn
+}
+
+// GetID returns the ID field if it's non-nil, zero value otherwise.
+func (e *EnterpriseNetworkConfiguration) GetID() string {
+	if e == nil || e.ID == nil {
+		return ""
+	}
+	return *e.ID
+}
+
+// GetName returns the Name field if it's non-nil, zero value otherwise.
+func (e *EnterpriseNetworkConfiguration) GetName() string {
+	if e == nil || e.Name == nil {
+		return ""
+	}
+	return *e.Name
+}
+
+// GetComputeService returns the ComputeService field.
+func (e *EnterpriseNetworkConfigurationRequest) GetComputeService() *ComputeService {
+	if e == nil {
+		return nil
+	}
+	return e.ComputeService
+}
+
+// GetName returns the Name field if it's non-nil, zero value otherwise.
+func (e *EnterpriseNetworkConfigurationRequest) GetName() string {
+	if e == nil || e.Name == nil {
+		return ""
+	}
+	return *e.Name
+}
+
+// GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise.
+func (e *EnterpriseNetworkConfigurations) GetTotalCount() int64 {
+	if e == nil || e.TotalCount == nil {
+		return 0
+	}
+	return *e.TotalCount
+}
+
+// GetID returns the ID field if it's non-nil, zero value otherwise.
+func (e *EnterpriseNetworkSettingsResource) GetID() string {
+	if e == nil || e.ID == nil {
+		return ""
+	}
+	return *e.ID
+}
+
+// GetName returns the Name field if it's non-nil, zero value otherwise.
+func (e *EnterpriseNetworkSettingsResource) GetName() string {
+	if e == nil || e.Name == nil {
+		return ""
+	}
+	return *e.Name
+}
+
+// GetNetworkConfigurationID returns the NetworkConfigurationID field if it's non-nil, zero value otherwise.
+func (e *EnterpriseNetworkSettingsResource) GetNetworkConfigurationID() string {
+	if e == nil || e.NetworkConfigurationID == nil {
+		return ""
+	}
+	return *e.NetworkConfigurationID
+}
+
+// GetRegion returns the Region field if it's non-nil, zero value otherwise.
+func (e *EnterpriseNetworkSettingsResource) GetRegion() string {
+	if e == nil || e.Region == nil {
+		return ""
+	}
+	return *e.Region
+}
+
+// GetSubnetID returns the SubnetID field if it's non-nil, zero value otherwise.
+func (e *EnterpriseNetworkSettingsResource) GetSubnetID() string {
+	if e == nil || e.SubnetID == nil {
+		return ""
+	}
+	return *e.SubnetID
+}
+
 // GetAllowsPublicRepositories returns the AllowsPublicRepositories field if it's non-nil, zero value otherwise.
 func (e *EnterpriseRunnerGroup) GetAllowsPublicRepositories() bool {
 	if e == nil || e.AllowsPublicRepositories == nil {


Test patch:
diff --git a/github/enterprise_network_configurations_test.go b/github/enterprise_network_configurations_test.go
new file mode 100644
index 00000000..c9a9acc8
--- /dev/null
+++ b/github/enterprise_network_configurations_test.go
@@ -0,0 +1,335 @@
+// Copyright 2025 The go-github AUTHORS. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package github
+
+import (
+	"context"
+	"fmt"
+	"net/http"
+	"testing"
+	"time"
+
+	"github.com/google/go-cmp/cmp"
+)
+
+func TestEnterpriseService_ListEnterpriseNetworkConfigurations(t *testing.T) {
+	t.Parallel()
+	client, mux, _ := setup(t)
+
+	mux.HandleFunc(" /enterprises/e/network-configurations", func(w http.ResponseWriter, r *http.Request) {
+		testMethod(t, r, "GET")
+		testFormValues(t, r, values{"page": "3", "per_page": "2"})
+		fmt.Fprintf(w, `{
+		  "total_count": 2,
+		  "network_configurations": [
+			{
+			  "id": "123456789ABCDEF",
+			  "name": "configuration_one",
+			  "compute_service": "actions",
+			  "network_settings_ids": [
+				"23456789ABDCEF1",
+				"3456789ABDCEF12"
+			  ],
+			  "created_on": "2024-04-09T17:30:15Z"
+			},
+			{
+			  "id": "456789ABDCEF123",
+			  "name": "configuration_two",
+			  "compute_service": "none",
+			  "network_settings_ids": [
+				"56789ABDCEF1234",
+				"6789ABDCEF12345"
+			  ],
+			  "created_on": "2024-11-02T12:30:30Z"
+			}
+		  ]
+		}`)
+	})
+
+	ctx := context.Background()
+
+	opts := &ListOptions{Page: 3, PerPage: 2}
+	configurations, _, err := client.Enterprise.ListEnterpriseNetworkConfigurations(ctx, "e", opts)
+	if err != nil {
+		t.Errorf("Enterprise.ListEnterpriseNetworkConfigurations returned error: %v", err)
+	}
+
+	want := &EnterpriseNetworkConfigurations{
+		TotalCount: Ptr(int64(2)),
+		NetworkConfigurations: []*EnterpriseNetworkConfiguration{
+			{
+				ID:                 Ptr("123456789ABCDEF"),
+				Name:               Ptr("configuration_one"),
+				ComputeService:     Ptr(ComputeService("actions")),
+				NetworkSettingsIDs: []string{"23456789ABDCEF1", "3456789ABDCEF12"},
+				CreatedOn:          &Timestamp{time.Date(2024, 4, 9, 17, 30, 15, 0, time.UTC)},
+			},
+			{
+				ID:                 Ptr("456789ABDCEF123"),
+				Name:               Ptr("configuration_two"),
+				ComputeService:     Ptr(ComputeService("none")),
+				NetworkSettingsIDs: []string{"56789ABDCEF1234", "6789ABDCEF12345"},
+				CreatedOn:          &Timestamp{time.Date(2024, 11, 2, 12, 30, 30, 0, time.UTC)},
+			},
+		},
+	}
+	if !cmp.Equal(configurations, want) {
+		t.Errorf("Enterprise.ListEnterpriseNetworkConfigurations mismatch (-want +got):\n%s", cmp.Diff(want, configurations))
+	}
+
+	const methodName = "ListEnterpriseNetworkConfigurations"
+	testBadOptions(t, methodName, func() error {
+		_, _, err = client.Enterprise.ListEnterpriseNetworkConfigurations(ctx, "\ne", opts)
+		return err
+	})
+
+	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
+		got, resp, err := client.Enterprise.ListEnterpriseNetworkConfigurations(ctx, "e", opts)
+		if got != nil {
+			t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
+		}
+		return resp, err
+	})
+}
+
+func TestEnterpriseService_CreateEnterpriseNetworkConfiguration(t *testing.T) {
+	t.Parallel()
+	client, mux, _ := setup(t)
+
+	mux.HandleFunc("/enterprises/e/network-configurations", func(w http.ResponseWriter, r *http.Request) {
+		testMethod(t, r, "POST")
+		fmt.Fprintf(w, `{
+		  "id": "123456789ABCDEF",
+		  "name": "configuration_one",
+		  "compute_service": "actions",
+		  "network_settings_ids": [
+			"23456789ABDCEF1",
+			"3456789ABDCEF12"
+		  ],
+		  "created_on": "2024-04-09T17:30:15Z"
+		}`)
+	})
+
+	ctx := context.Background()
+
+	req := EnterpriseNetworkConfigurationRequest{
+		Name:           Ptr("configuration_one"),
+		ComputeService: Ptr(ComputeService("actions")),
+		NetworkSettingsIDs: []string{
+			"23456789ABDCEF1",
+			"3456789ABDCEF12",
+		},
+	}
+	configuration, _, err := client.Enterprise.CreateEnterpriseNetworkConfiguration(ctx, "e", req)
+	if err != nil {
+		t.Errorf("Enterprise.CreateEnterpriseNetworkConfiguration returned error: %v", err)
+	}
+
+	want := &EnterpriseNetworkConfiguration{
+		ID:                 Ptr("123456789ABCDEF"),
+		Name:               Ptr("configuration_one"),
+		ComputeService:     Ptr(ComputeService("actions")),
+		NetworkSettingsIDs: []string{"23456789ABDCEF1", "3456789ABDCEF12"},
+		CreatedOn:          &Timestamp{time.Date(2024, 4, 9, 17, 30, 15, 0, time.UTC)},
+	}
+	if !cmp.Equal(configuration, want) {
+		t.Errorf("Enterprise.CreateEnterpriseNetworkConfiguration mismatch (-want +got):\n%s", cmp.Diff(want, configuration))
+	}
+
+	const methodName = "CreateEnterpriseNetworkConfiguration"
+	testBadOptions(t, methodName, func() error {
+		_, _, err = client.Enterprise.CreateEnterpriseNetworkConfiguration(ctx, "\ne", req)
+		return err
+	})
+
+	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
+		got, resp, err := client.Enterprise.CreateEnterpriseNetworkConfiguration(ctx, "e", req)
+		if got != nil {
+			t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
+		}
+		return resp, err
+	})
+}
+
+func TestEnterpriseService_GetEnterpriseNetworkConfiguration(t *testing.T) {
+	t.Parallel()
+	client, mux, _ := setup(t)
+
+	mux.HandleFunc("/enterprises/e/network-configurations/123456789ABCDEF", func(w http.ResponseWriter, r *http.Request) {
+		testMethod(t, r, "GET")
+		fmt.Fprintf(w, `{
+		  "id": "123456789ABCDEF",
+		  "name": "configuration_one",
+		  "compute_service": "actions",
+		  "network_settings_ids": [
+			"23456789ABDCEF1",
+			"3456789ABDCEF12"
+		  ],
+		  "created_on": "2024-12-10T19:00:15Z"
+		}`)
+	})
+
+	ctx := context.Background()
+	configuration, _, err := client.Enterprise.GetEnterpriseNetworkConfiguration(ctx, "e", "123456789ABCDEF")
+	if err != nil {
+		t.Errorf("Enterprise.GetEnterpriseNetworkConfiguration returned err: %v", err)
+	}
+
+	want := &EnterpriseNetworkConfiguration{
+		ID:                 Ptr("123456789ABCDEF"),
+		Name:               Ptr("configuration_one"),
+		ComputeService:     Ptr(ComputeService("actions")),
+		NetworkSettingsIDs: []string{"23456789ABDCEF1", "3456789ABDCEF12"},
+		CreatedOn:          &Timestamp{time.Date(2024, 12, 10, 19, 00, 15, 0, time.UTC)},
+	}
+	if !cmp.Equal(configuration, want) {
+		t.Errorf("Enterprise.GetEnterpriseNetworkConfiguration mismatch (-want +got):\n%s", cmp.Diff(want, configuration))
+	}
+
+	const methodName = "GetEnterpriseNetworkConfiguration"
+	testBadOptions(t, methodName, func() error {
+		_, _, err = client.Enterprise.GetEnterpriseNetworkConfiguration(ctx, "\ne", "123456789ABCDEF")
+		return err
+	})
+
+	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
+		got, resp, err := client.Enterprise.GetEnterpriseNetworkConfiguration(ctx, "e", "123456789ABCDEF")
+		if got != nil {
+			t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
+		}
+		return resp, err
+	})
+}
+
+func TestEnterpriseService_UpdateEnterpriseNetworkConfiguration(t *testing.T) {
+	t.Parallel()
+	client, mux, _ := setup(t)
+
+	mux.HandleFunc("/enterprises/e/network-configurations/123456789ABCDEF", func(w http.ResponseWriter, r *http.Request) {
+		testMethod(t, r, "PATCH")
+		fmt.Fprintf(w, `{
+		  "id": "123456789ABCDEF",
+		  "name": "updated_configuration_one",
+		  "compute_service": "none",
+		  "network_settings_ids": [
+			"456789ABDCEF123",
+			"56789ABDCEF1234"
+		  ],
+		  "created_on": "2024-12-10T19:00:15Z"
+		}`)
+	})
+
+	ctx := context.Background()
+	req := EnterpriseNetworkConfigurationRequest{
+		Name: Ptr("updated_configuration_one"),
+		NetworkSettingsIDs: []string{
+			"456789ABDCEF123",
+			"56789ABDCEF1234",
+		},
+		ComputeService: Ptr(ComputeService("none")),
+	}
+	configuration, _, err := client.Enterprise.UpdateEnterpriseNetworkConfiguration(ctx, "e", "123456789ABCDEF", req)
+	if err != nil {
+		t.Errorf("Enterprise.UpdateEnterpriseNetworkConfiguration returned error %v", err)
+	}
+
+	want := &EnterpriseNetworkConfiguration{
+		ID:                 Ptr("123456789ABCDEF"),
+		Name:               Ptr("updated_configuration_one"),
+		ComputeService:     Ptr(ComputeService("none")),
+		NetworkSettingsIDs: []string{"456789ABDCEF123", "56789ABDCEF1234"},
+		CreatedOn:          &Timestamp{time.Date(2024, 12, 10, 19, 00, 15, 0, time.UTC)},
+	}
+	if !cmp.Equal(configuration, want) {
+		t.Errorf("Enterprise.UpdateEnterpriseNetworkConfiguration mismatch (-want +get)\n%s", cmp.Diff(want, configuration))
+	}
+
+	const methodName = "UpdateEnterpriseNetworkConfiguration"
+	testBadOptions(t, methodName, func() error {
+		_, _, err = client.Enterprise.UpdateEnterpriseNetworkConfiguration(ctx, "\ne", "123456789ABCDEF", req)
+		return err
+	})
+
+	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
+		got, resp, err := client.Enterprise.UpdateEnterpriseNetworkConfiguration(ctx, "e", "123456789ABCDEF", req)
+		if got != nil {
+			t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
+		}
+		return resp, err
+	})
+}
+
+func TestEnterpriseService_DeleteEnterpriseNetworkConfiguration(t *testing.T) {
+	t.Parallel()
+	client, mux, _ := setup(t)
+
+	mux.HandleFunc("/enterprises/e/network-configurations/123456789ABCDEF", func(w http.ResponseWriter, r *http.Request) {
+		testMethod(t, r, "DELETE")
+	})
+
+	ctx := context.Background()
+	_, err := client.Enterprise.DeleteEnterpriseNetworkConfiguration(ctx, "e", "123456789ABCDEF")
+	if err != nil {
+		t.Errorf("Enterprise.DeleteEnterpriseNetworkConfiguration returned error %v", err)
+	}
+
+	const methodName = "DeleteEnterpriseNetworkConfiguration"
+	testBadOptions(t, methodName, func() error {
+		_, err = client.Enterprise.DeleteEnterpriseNetworkConfiguration(ctx, "\ne", "123456789ABCDEF")
+		return err
+	})
+
+	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
+		return client.Enterprise.DeleteEnterpriseNetworkConfiguration(ctx, "e", "123456789ABCDEF")
+	})
+}
+
+func TestEnterpriseService_GetEnterpriseNetworkSettingsResource(t *testing.T) {
+	t.Parallel()
+	client, mux, _ := setup(t)
+
+	mux.HandleFunc("/enterprises/e/network-settings/123456789ABCDEF", func(w http.ResponseWriter, r *http.Request) {
+		testMethod(t, r, "GET")
+		fmt.Fprintf(w, `{
+			"id": "220F78DACB92BBFBC5E6F22DE1CCF52309D",
+			"network_configuration_id": "934E208B3EE0BD60CF5F752C426BFB53562",
+			"name": "my_network_settings",
+			"subnet_id": "/subscriptions/14839728-3ad9-43ab-bd2b-fa6ad0f75e2a/resourceGroups/my-rg/providers/Microsoft.Network/virtualNetworks/my-vnet/subnets/my-subnet",
+			"region": "germanywestcentral"
+		}`)
+	})
+
+	ctx := context.Background()
+	resource, _, err := client.Enterprise.GetEnterpriseNetworkSettingsResource(ctx, "e", "123456789ABCDEF")
+	if err != nil {
+		t.Errorf("Enterprise.GetEnterpriseNetworkSettingsResource returned error %v", err)
+	}
+
+	want := &EnterpriseNetworkSettingsResource{
+		ID:                     Ptr("220F78DACB92BBFBC5E6F22DE1CCF52309D"),
+		NetworkConfigurationID: Ptr("934E208B3EE0BD60CF5F752C426BFB53562"),
+		Name:                   Ptr("my_network_settings"),
+		SubnetID:               Ptr("/subscriptions/14839728-3ad9-43ab-bd2b-fa6ad0f75e2a/resourceGroups/my-rg/providers/Microsoft.Network/virtualNetworks/my-vnet/subnets/my-subnet"),
+		Region:                 Ptr("germanywestcentral"),
+	}
+	if !cmp.Equal(resource, want) {
+		t.Errorf("Enterprise.GetEnterpriseNetworkSettingsResource mistach (-want +got):\n%s", cmp.Diff(want, resource))
+	}
+
+	const methodName = "GetEnterpriseNetworkSettingsResource"
+	testBadOptions(t, methodName, func() error {
+		_, _, err = client.Enterprise.GetEnterpriseNetworkSettingsResource(ctx, "\ne", "123456789ABCDEF")
+		return err
+	})
+
+	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
+		got, resp, err := client.Enterprise.GetEnterpriseNetworkSettingsResource(ctx, "e", "123456789ABCDEF")
+		if got != nil {
+			t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
+		}
+		return resp, err
+	})
+}
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index 8d69ad42..7da18057 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -11118,6 +11118,132 @@ func TestEnterprise_GetWebsiteURL(tt *testing.T) {
 	e.GetWebsiteURL()
 }
 
+func TestEnterpriseNetworkConfiguration_GetComputeService(tt *testing.T) {
+	tt.Parallel()
+	e := &EnterpriseNetworkConfiguration{}
+	e.GetComputeService()
+	e = nil
+	e.GetComputeService()
+}
+
+func TestEnterpriseNetworkConfiguration_GetCreatedOn(tt *testing.T) {
+	tt.Parallel()
+	var zeroValue Timestamp
+	e := &EnterpriseNetworkConfiguration{CreatedOn: &zeroValue}
+	e.GetCreatedOn()
+	e = &EnterpriseNetworkConfiguration{}
+	e.GetCreatedOn()
+	e = nil
+	e.GetCreatedOn()
+}
+
+func TestEnterpriseNetworkConfiguration_GetID(tt *testing.T) {
+	tt.Parallel()
+	var zeroValue string
+	e := &EnterpriseNetworkConfiguration{ID: &zeroValue}
+	e.GetID()
+	e = &EnterpriseNetworkConfiguration{}
+	e.GetID()
+	e = nil
+	e.GetID()
+}
+
+func TestEnterpriseNetworkConfiguration_GetName(tt *testing.T) {
+	tt.Parallel()
+	var zeroValue string
+	e := &EnterpriseNetworkConfiguration{Name: &zeroValue}
+	e.GetName()
+	e = &EnterpriseNetworkConfiguration{}
+	e.GetName()
+	e = nil
+	e.GetName()
+}
+
+func TestEnterpriseNetworkConfigurationRequest_GetComputeService(tt *testing.T) {
+	tt.Parallel()
+	e := &EnterpriseNetworkConfigurationRequest{}
+	e.GetComputeService()
+	e = nil
+	e.GetComputeService()
+}
+
+func TestEnterpriseNetworkConfigurationRequest_GetName(tt *testing.T) {
+	tt.Parallel()
+	var zeroValue string
+	e := &EnterpriseNetworkConfigurationRequest{Name: &zeroValue}
+	e.GetName()
+	e = &EnterpriseNetworkConfigurationRequest{}
+	e.GetName()
+	e = nil
+	e.GetName()
+}
+
+func TestEnterpriseNetworkConfigurations_GetTotalCount(tt *testing.T) {
+	tt.Parallel()
+	var zeroValue int64
+	e := &EnterpriseNetworkConfigurations{TotalCount: &zeroValue}
+	e.GetTotalCount()
+	e = &EnterpriseNetworkConfigurations{}
+	e.GetTotalCount()
+	e = nil
+	e.GetTotalCount()
+}
+
+func TestEnterpriseNetworkSettingsResource_GetID(tt *testing.T) {
+	tt.Parallel()
+	var zeroValue string
+	e := &EnterpriseNetworkSettingsResource{ID: &zeroValue}
+	e.GetID()
+	e = &EnterpriseNetworkSettingsResource{}
+	e.GetID()
+	e = nil
+	e.GetID()
+}
+
+func TestEnterpriseNetworkSettingsResource_GetName(tt *testing.T) {
+	tt.Parallel()
+	var zeroValue string
+	e := &EnterpriseNetworkSettingsResource{Name: &zeroValue}
+	e.GetName()
+	e = &EnterpriseNetworkSettingsResource{}
+	e.GetName()
+	e = nil
+	e.GetName()
+}
+
+func TestEnterpriseNetworkSettingsResource_GetNetworkConfigurationID(tt *testing.T) {
+	tt.Parallel()
+	var zeroValue string
+	e := &EnterpriseNetworkSettingsResource{NetworkConfigurationID: &zeroValue}
+	e.GetNetworkConfigurationID()
+	e = &EnterpriseNetworkSettingsResource{}
+	e.GetNetworkConfigurationID()
+	e = nil
+	e.GetNetworkConfigurationID()
+}
+
+func TestEnterpriseNetworkSettingsResource_GetRegion(tt *testing.T) {
+	tt.Parallel()
+	var zeroValue string
+	e := &EnterpriseNetworkSettingsResource{Region: &zeroValue}
+	e.GetRegion()
+	e = &EnterpriseNetworkSettingsResource{}
+	e.GetRegion()
+	e = nil
+	e.GetRegion()
+}
+
+func TestEnterpriseNetworkSettingsResource_GetSubnetID(tt *testing.T) {
+	tt.Parallel()
+	var zeroValue string
+	e := &EnterpriseNetworkSettingsResource{SubnetID: &zeroValue}
+	e.GetSubnetID()
+	e = &EnterpriseNetworkSettingsResource{}
+	e.GetSubnetID()
+	e = nil
+	e.GetSubnetID()
+}
+
 func TestEnterpriseRunnerGroup_GetAllowsPublicRepositories(tt *testing.T) {
 	tt.Parallel()
 	var zeroValue bool