using System; using System.Reactive.Threading.Tasks; using Octokit.Reactive.Internal; namespace Octokit.Reactive { public class ObservableActionsSelfHostedRunnerGroupsClient : IObservableActionsSelfHostedRunnerGroupsClient { readonly IActionsSelfHostedRunnerGroupsClient _client; readonly IConnection _connection; /// /// Instantiate a new GitHub Actions Self-hosted runner groups API client. /// /// A GitHub client. public ObservableActionsSelfHostedRunnerGroupsClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, nameof(client)); _client = client.Actions.SelfHostedRunnerGroups; _connection = client.Connection; } /// /// List self-hosted runner groups for an enterprise /// /// /// https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runner-groups-for-an-enterprise /// /// The enterprise name public IObservable ListAllRunnerGroupsForEnterprise(string enterprise) { return ListAllRunnerGroupsForEnterprise(enterprise, ApiOptions.None); } /// /// List self-hosted runner groups for an enterprise /// /// /// https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runner-groups-for-an-enterprise /// /// The enterprise name /// Options for changing the API response public IObservable ListAllRunnerGroupsForEnterprise(string enterprise, ApiOptions options) { Ensure.ArgumentNotNullOrEmptyString(enterprise, nameof(enterprise)); Ensure.ArgumentNotNull(options, nameof(options)); return _client.ListAllRunnerGroupsForEnterprise(enterprise, options).ToObservable(); } /// /// List self-hosted runner groups for an organization /// /// /// https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runner-groups-for-an-organization /// /// The organization name public IObservable ListAllRunnerGroupsForOrganization(string org) { return ListAllRunnerGroupsForOrganization(org, ApiOptions.None); } /// /// List self-hosted runner groups for an organization /// /// /// https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runner-groups-for-an-organization /// /// The organization name /// Options for changing the API response public IObservable ListAllRunnerGroupsForOrganization(string org, ApiOptions options) { Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); Ensure.ArgumentNotNull(options, nameof(options)); return _client.ListAllRunnerGroupsForOrganization(org, options).ToObservable(); } /// /// Lists all self-hosted runners in a self-hosted runner group configured in an enterprise /// /// /// https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runners-in-a-group-for-an-enterprise /// /// The enterprise name /// The runner group ID public IObservable ListAllRunnersForEnterpriseRunnerGroup(string enterprise, long groupId) { return ListAllRunnersForEnterpriseRunnerGroup(enterprise, groupId, ApiOptions.None); } /// /// Lists all self-hosted runners in a self-hosted runner group configured in an enterprise /// /// /// https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runners-in-a-group-for-an-enterprise /// /// The enterprise name /// The runner group ID /// Options for changing the API response public IObservable ListAllRunnersForEnterpriseRunnerGroup(string enterprise, long groupId, ApiOptions options) { Ensure.ArgumentNotNull(options, nameof(options)); return _client.ListAllRunnersForEnterpriseRunnerGroup(enterprise, groupId, options).ToObservable(); } /// /// Lists all self-hosted runners in a self-hosted runner group configured in an organization /// /// /// https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runners-in-a-group-for-an-organization /// /// The organization name /// The runner group ID public IObservable ListAllRunnersForOrganizationRunnerGroup(string organization, long groupId) { return ListAllRunnersForOrganizationRunnerGroup(organization, groupId, ApiOptions.None); } /// /// Lists all self-hosted runners in a self-hosted runner group configured in an organization /// /// /// https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-self-hosted-runners-in-a-group-for-an-organization /// /// The organization name /// The runner group ID /// Options for changing the API response public IObservable ListAllRunnersForOrganizationRunnerGroup(string organization, long groupId, ApiOptions options) { Ensure.ArgumentNotNullOrEmptyString(organization, nameof(organization)); Ensure.ArgumentNotNull(options, nameof(options)); return _client.ListAllRunnersForOrganizationRunnerGroup(organization, groupId, options).ToObservable(); } /// /// List organization access to a self-hosted runner group in an enterprise /// /// /// https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-organization-access-to-a-self-hosted-runner-group-in-an-enterprise /// /// The enterprise name /// The runner group ID public IObservable ListAllRunnerGroupOrganizationsForEnterprise(string enterprise, long runnerGroupId) { return ListAllRunnerGroupOrganizationsForEnterprise(enterprise, runnerGroupId, ApiOptions.None); } /// /// List organization access to a self-hosted runner group in an enterprise /// /// /// https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-organization-access-to-a-self-hosted-runner-group-in-an-enterprise /// /// The enterprise name /// The runner group ID /// Options for changing the API response public IObservable ListAllRunnerGroupOrganizationsForEnterprise(string enterprise, long runnerGroupId, ApiOptions options) { Ensure.ArgumentNotNullOrEmptyString(enterprise, nameof(enterprise)); Ensure.ArgumentNotNull(options, nameof(options)); return _connection.GetAndFlattenAllPages(ApiUrls.ActionsListEnterpriseRunnerGroupOrganizations(enterprise, runnerGroupId), options); } /// /// List repository access to a self-hosted runner group in an organization /// /// /// https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-repository-access-to-a-self-hosted-runner-group-in-an-organization /// /// The organization name /// The runner group ID public IObservable ListAllRunnerGroupRepositoriesForOrganization(string org, long runnerGroupId) { return ListAllRunnerGroupRepositoriesForOrganization(org, runnerGroupId, ApiOptions.None); } /// /// List repository access to a self-hosted runner group in an organization /// /// /// https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runner-groups?apiVersion=2022-11-28#list-repository-access-to-a-self-hosted-runner-group-in-an-organization /// /// The organization name /// The runner group ID /// Options for changing the API response public IObservable ListAllRunnerGroupRepositoriesForOrganization(string org, long runnerGroupId, ApiOptions options) { Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); Ensure.ArgumentNotNull(options, nameof(options)); return _connection.GetAndFlattenAllPages(ApiUrls.ActionsListOrganizationRunnerGroupRepositories(org, runnerGroupId), options); } } }