Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ The value must be a valid ISO 8601 datetime string (UTC).
{
Description = @"Filter runs that started before the specified date and time (inclusive).
The value must be a valid ISO 8601 datetime string (UTC).
",
};

private static Option<global::System.Collections.Generic.IList<string>?> Deployment { get; } = new(
name: @"--deployment")
{
Description = @"Single Actor Standby deployment or comma-separated list of deployments (`SINGLE_TENANT`, `MULTI_TENANT_FREE_USERS`,
`MULTI_TENANT_PAYING_USERS` or `MULTI_TENANT_OWNER_PAID`). Used to filter Actor Standby runs by the pool that
serves them. Requires the `status` parameter with only non-terminal statuses (`READY`, `RUNNING`, `TIMING-OUT` or
`ABORTING`).
",
};

Expand Down Expand Up @@ -94,6 +104,7 @@ each object contains basic information about a single Actor run.
command.Options.Add(Status);
command.Options.Add(StartedAfter);
command.Options.Add(StartedBefore);
command.Options.Add(Deployment);


command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) =>
Expand All @@ -105,6 +116,7 @@ await CliRuntime.RunAsync(async () =>
var status = parseResult.GetValue(Status);
var startedAfter = parseResult.GetValue(StartedAfter);
var startedBefore = parseResult.GetValue(StartedBefore);
var deployment = parseResult.GetValue(Deployment);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


Expand All @@ -115,6 +127,7 @@ await CliRuntime.RunAsync(async () =>
status: status,
startedAfter: startedAfter,
startedBefore: startedBefore,
deployment: deployment,
cancellationToken: cancellationToken).ConfigureAwait(false);


Expand Down
13 changes: 11 additions & 2 deletions src/cli/Apify.CLI/Commands/ActorStandbyOptionSet.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ internal sealed record ActorStandbyOptionSet(
Option<string?> Build,
Option<long?> MemoryMbytes,
Option<bool?> DisableStandbyFieldsOverride,
Option<bool?> ShouldPassActorInput)
Option<bool?> ShouldPassActorInput,
Option<string?> Tenancy,
Option<bool?> IsConsoleAuthEnabled,
Option<bool?> IsTokenlessEnabled)
{
public static ActorStandbyOptionSet Create(string? prefix = null)
{
Expand Down Expand Up @@ -42,7 +45,13 @@ public static ActorStandbyOptionSet Create(string? prefix = null)
Description = @"In MB, the amount of memory allocated to the run.",
},
DisableStandbyFieldsOverride: CliRuntime.CreateNullableBoolOption(name: $"--{normalizedPrefix}disable-standby-fields-override", description: @"If `true`, prevents the standby mode configuration from being overridden elsewhere."),
ShouldPassActorInput: CliRuntime.CreateNullableBoolOption(name: $"--{normalizedPrefix}should-pass-actor-input", description: @"Whether to pass the Actor's input to the standby run. If `false`, the standby runs start with no input.")
ShouldPassActorInput: CliRuntime.CreateNullableBoolOption(name: $"--{normalizedPrefix}should-pass-actor-input", description: @"Whether to pass the Actor's input to the standby run. If `false`, the standby runs start with no input."),
Tenancy: new Option<string?>($"--{normalizedPrefix}tenancy")
{
Description = @"Whether each user gets their own standby runs (`SINGLE_TENANT`) or runs are shared across users (`MULTI_TENANT`). Set by Apify.",
},
IsConsoleAuthEnabled: CliRuntime.CreateNullableBoolOption(name: $"--{normalizedPrefix}is-console-auth-enabled", description: @"Whether standby requests can be authenticated with an Apify Console session. Set by Apify."),
IsTokenlessEnabled: CliRuntime.CreateNullableBoolOption(name: $"--{normalizedPrefix}is-tokenless-enabled", description: @"Whether standby requests can be made without an API token. Set by Apify.")
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ [Get Actor task input](/api/v2/actor-task-input-get) endpoint.

When providing your API authentication token, we recommend using the
request's `Authorization` header, rather than the URL.
For details, see [Authentication](/api/v2/getting-started#authentication).
For details, see [Authentication](/api/v2#authentication).
");
command.Arguments.Add(ActorTaskId);
command.Options.Add(Input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ [Get Actor task](/api/v2/actor-task-get) endpoint.
command.Options.Add(ActorStandbyOptions.MemoryMbytes);
command.Options.Add(ActorStandbyOptions.DisableStandbyFieldsOverride);
command.Options.Add(ActorStandbyOptions.ShouldPassActorInput);
command.Options.Add(ActorStandbyOptions.Tenancy);
command.Options.Add(ActorStandbyOptions.IsConsoleAuthEnabled);
command.Options.Add(ActorStandbyOptions.IsTokenlessEnabled);
command.Options.Add(RequestInput);
command.Options.Add(RequestJson);
command.Options.Add(RequestFile);
Expand Down Expand Up @@ -189,7 +192,10 @@ await CliRuntime.RunAsync(async () =>
var actorStandbyMemoryMbytes = CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.MemoryMbytes) ? parseResult.GetValue(ActorStandbyOptions.MemoryMbytes) : (__ActorStandbyBase is { } __ActorStandbymemoryMbytesBaseValue ? __ActorStandbymemoryMbytesBaseValue.MemoryMbytes : default);
var actorStandbyDisableStandbyFieldsOverride = CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.DisableStandbyFieldsOverride) ? parseResult.GetValue(ActorStandbyOptions.DisableStandbyFieldsOverride) : (__ActorStandbyBase is { } __ActorStandbydisableStandbyFieldsOverrideBaseValue ? __ActorStandbydisableStandbyFieldsOverrideBaseValue.DisableStandbyFieldsOverride : default);
var actorStandbyShouldPassActorInput = CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.ShouldPassActorInput) ? parseResult.GetValue(ActorStandbyOptions.ShouldPassActorInput) : (__ActorStandbyBase is { } __ActorStandbyshouldPassActorInputBaseValue ? __ActorStandbyshouldPassActorInputBaseValue.ShouldPassActorInput : default);
var __ActorStandbySpecified = CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.IsEnabled) || CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.DesiredRequestsPerActorRun) || CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.MaxRequestsPerActorRun) || CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.IdleTimeoutSecs) || CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.Build) || CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.MemoryMbytes) || CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.DisableStandbyFieldsOverride) || CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.ShouldPassActorInput);
var actorStandbyTenancy = CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.Tenancy) ? parseResult.GetValue(ActorStandbyOptions.Tenancy) : (__ActorStandbyBase is { } __ActorStandbytenancyBaseValue ? __ActorStandbytenancyBaseValue.Tenancy : default);
var actorStandbyIsConsoleAuthEnabled = CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.IsConsoleAuthEnabled) ? parseResult.GetValue(ActorStandbyOptions.IsConsoleAuthEnabled) : (__ActorStandbyBase is { } __ActorStandbyisConsoleAuthEnabledBaseValue ? __ActorStandbyisConsoleAuthEnabledBaseValue.IsConsoleAuthEnabled : default);
var actorStandbyIsTokenlessEnabled = CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.IsTokenlessEnabled) ? parseResult.GetValue(ActorStandbyOptions.IsTokenlessEnabled) : (__ActorStandbyBase is { } __ActorStandbyisTokenlessEnabledBaseValue ? __ActorStandbyisTokenlessEnabledBaseValue.IsTokenlessEnabled : default);
var __ActorStandbySpecified = CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.IsEnabled) || CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.DesiredRequestsPerActorRun) || CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.MaxRequestsPerActorRun) || CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.IdleTimeoutSecs) || CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.Build) || CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.MemoryMbytes) || CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.DisableStandbyFieldsOverride) || CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.ShouldPassActorInput) || CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.Tenancy) || CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.IsConsoleAuthEnabled) || CliRuntime.WasSpecified(parseResult, ActorStandbyOptions.IsTokenlessEnabled);
var actorStandby =
__ActorStandbySpecified || __ActorStandbyBase is not null
? new global::Apify.ActorStandby
Expand All @@ -202,6 +208,9 @@ await CliRuntime.RunAsync(async () =>
MemoryMbytes = actorStandbyMemoryMbytes,
DisableStandbyFieldsOverride = actorStandbyDisableStandbyFieldsOverride,
ShouldPassActorInput = actorStandbyShouldPassActorInput,
Tenancy = actorStandbyTenancy,
IsConsoleAuthEnabled = actorStandbyIsConsoleAuthEnabled,
IsTokenlessEnabled = actorStandbyIsTokenlessEnabled,

}
: __ActorStandbyBase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ You can access the maximum cost in your Actor
",
};

private static Option<bool?> RestartOnError { get; } = CliRuntime.CreateNullableBoolOption(
name: @"--restart-on-error",
description: @"Determines whether the run will be restarted if it fails.
");

private static Option<string?> Build { get; } = new(
name: @"--build")
{
Expand Down Expand Up @@ -131,6 +136,7 @@ endpoint instead.
command.Options.Add(Memory);
command.Options.Add(MaxItems);
command.Options.Add(MaxTotalChargeUsd);
command.Options.Add(RestartOnError);
command.Options.Add(Build);
command.Options.Add(OutputRecordKey);
command.Options.Add(Webhooks);
Expand All @@ -144,6 +150,7 @@ await CliRuntime.RunAsync(async () =>
var memory = parseResult.GetValue(Memory);
var maxItems = parseResult.GetValue(MaxItems);
var maxTotalChargeUsd = parseResult.GetValue(MaxTotalChargeUsd);
var restartOnError = parseResult.GetValue(RestartOnError);
var build = parseResult.GetValue(Build);
var outputRecordKey = parseResult.GetValue(OutputRecordKey);
var webhooks = parseResult.GetValue(Webhooks);
Expand All @@ -156,6 +163,7 @@ await CliRuntime.RunAsync(async () =>
memory: memory,
maxItems: maxItems,
maxTotalChargeUsd: maxTotalChargeUsd,
restartOnError: restartOnError,
build: build,
outputRecordKey: outputRecordKey,
webhooks: webhooks,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#nullable enable
#pragma warning disable CS0618

using System.CommandLine;

namespace Apify.CLI.Commands;

internal static partial class ActorsActorOAuthAccountGetCommandApiCommand
{
private static Argument<string> AccountId { get; } = new(
name: @"account-id")
{
Description = @"Actor OAuth account ID.",
};

private static string FormatResponse(ParseResult parseResult, global::Apify.ActorOAuthAccountResponse value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
{
string? text = null;
CustomizeResponseText(parseResult, value, ref text);
if (!string.IsNullOrWhiteSpace(text))
{
return text;
}

var hints = new Dictionary<string, CliFormatHint>(StringComparer.OrdinalIgnoreCase)
{
};
CustomizeResponseFormatHints(hints);
return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints);
}

static partial void CustomizeResponseText(ParseResult parseResult, global::Apify.ActorOAuthAccountResponse value, ref string? text);
static partial void CustomizeResponseFormatHints(Dictionary<string, CliFormatHint> hints);


static partial void CustomizeCommand(ref Command command);

public static Command Create(string? commandName = null)
{
var command = new Command(commandName ?? @"oauth-account-get", @"Get Actor OAuth account
Gets an account connected through an Actor OAuth connection, including its OAuth tokens.

This endpoint only accepts the API token of an Actor run (the `APIFY_TOKEN` environment variable of the run).
The run must belong to the Actor that the account's OAuth connection is configured on, and the account must
belong to the user the run's token acts for. Any other token gets a `403` error.
");
command.Arguments.Add(AccountId);


command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) =>
await CliRuntime.RunAsync(async () =>
{
var accountId = parseResult.GetRequiredValue(AccountId);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.Actors.ActorOAuthAccountGetAsync(
accountId: accountId,
cancellationToken: cancellationToken).ConfigureAwait(false);


await CliRuntime.WriteResponseAsync(
parseResult,
response,
global::Apify.SourceGenerationContext.Default,
FormatResponse,
cancellationToken).ConfigureAwait(false);
}, cancellationToken).ConfigureAwait(false));
CustomizeCommand(ref command);
return command;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#nullable enable
#pragma warning disable CS0618

using System.CommandLine;

namespace Apify.CLI.Commands;

internal static partial class ActorsActorOAuthAccountsGetCommandApiCommand
{
private static Argument<string> ConnectionId { get; } = new(
name: @"connection-id")
{
Description = @"Actor OAuth connection ID.",
};

private static string FormatResponse(ParseResult parseResult, global::Apify.ListOfActorOAuthAccountsResponse value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
{
string? text = null;
CustomizeResponseText(parseResult, value, ref text);
if (!string.IsNullOrWhiteSpace(text))
{
return text;
}

var hints = new Dictionary<string, CliFormatHint>(StringComparer.OrdinalIgnoreCase)
{
};
CustomizeResponseFormatHints(hints);
return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints);
}

static partial void CustomizeResponseText(ParseResult parseResult, global::Apify.ListOfActorOAuthAccountsResponse value, ref string? text);
static partial void CustomizeResponseFormatHints(Dictionary<string, CliFormatHint> hints);


static partial void CustomizeCommand(ref Command command);

public static Command Create(string? commandName = null)
{
var command = new Command(commandName ?? @"oauth-accounts-get", @"Get list of Actor OAuth accounts
Gets the accounts you connected through the Actor OAuth connection, including their OAuth tokens. Only accounts
that finished authorization are returned.

There are at most 5 accounts per user and connection, so the list is not paginated.
");
command.Arguments.Add(ConnectionId);


command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) =>
await CliRuntime.RunAsync(async () =>
{
var connectionId = parseResult.GetRequiredValue(ConnectionId);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.Actors.ActorOAuthAccountsGetAsync(
connectionId: connectionId,
cancellationToken: cancellationToken).ConfigureAwait(false);


await CliRuntime.WriteResponseAsync(
parseResult,
response,
global::Apify.SourceGenerationContext.Default,
FormatResponse,
cancellationToken).ConfigureAwait(false);
}, cancellationToken).ConfigureAwait(false));
CustomizeCommand(ref command);
return command;
}
}
Loading
Loading