├── .editorconfig ├── .gitignore ├── CHANGELOG.md ├── Directory.Build.props ├── Dockerfile ├── License.md ├── README.md ├── Samples └── Deploy │ ├── Access │ └── sample-policy.ac │ ├── CloudCode │ ├── Module │ │ └── Module.ccm │ └── Script │ │ └── Script.js │ ├── Economy │ ├── CURRENCY.ecc │ ├── INVENTORY_ITEM.eci │ ├── REAL_MONEY_PURCHASE.ecr │ └── VIRTUAL_MONEY_PURCHASE.ecv │ ├── Leaderboards │ └── lbsample.lb │ ├── Matchmaker │ ├── environment-config.mme │ └── queue.mmq │ ├── RemoteConfig │ └── configuration.rc │ ├── Triggers │ └── my-triggers.tr │ └── instructions.md ├── Third Party Notices.md ├── Unity.Services.Cli ├── .run │ └── Cli.run.xml ├── Unity.Services.Cli.Access.UnitTest │ ├── AccessModuleTests.cs │ ├── Deploy │ │ ├── AccessConfigLoaderTests.cs │ │ ├── AuthoringResultTests.cs │ │ ├── JsonConverterTests.cs │ │ ├── ProjectAccessClientTests.cs │ │ ├── ProjectAccessDeploymentHandlerTests.cs │ │ ├── ProjectAccessDeploymentServiceTests.cs │ │ ├── ProjectAccessFetchHandlerTests.cs │ │ └── ProjectAccessFetchServiceTests.cs │ ├── Handlers │ │ ├── DeletePlayerPolicyStatementsHandlerTests.cs │ │ ├── DeleteProjectPolicyStatementsHandlerTests.cs │ │ ├── GetAllPlayerPoliciesHandlerTests.cs │ │ ├── GetPlayerPolicyHandlerTests.cs │ │ ├── GetProjectPolicyHandlerTests.cs │ │ ├── UpsertPlayerPolicyHandlerTests.cs │ │ └── UpsertProjectPolicyHandlerTests.cs │ ├── Model │ │ └── ProjectAccessFileExtensionTests.cs │ ├── Service │ │ └── AccessServiceTests.cs │ ├── Unity.Services.Cli.Access.UnitTest.csproj │ └── Utils │ │ ├── TestMocks.cs │ │ └── TestValues.cs ├── Unity.Services.Cli.Access │ ├── AccessModule.cs │ ├── Deploy │ │ ├── AccessAuthoringResult.cs │ │ ├── AccessConfigLoader.cs │ │ ├── IAccessConfigLoader.cs │ │ ├── JsonConverter.cs │ │ ├── LoadResult.cs │ │ ├── ProjectAccessClient.cs │ │ ├── ProjectAccessDeploymentService.cs │ │ └── ProjectAccessFetchService.cs │ ├── Handlers │ │ ├── DeletePlayerPolicyStatementsHandler.cs │ │ ├── DeleteProjectPolicyStatementsHandler.cs │ │ ├── GetAllPlayerPoliciesHandler.cs │ │ ├── GetPlayerPolicyHandler.cs │ │ ├── GetProjectPolicyHandler.cs │ │ ├── UpsertPlayerPolicyHandler.cs │ │ └── UpsertProjectPolicyHandler.cs │ ├── IO │ │ └── FileSystem.cs │ ├── Input │ │ └── AccessInput.cs │ ├── Models │ │ ├── GetAllPlayerPoliciesResponseOutput.cs │ │ ├── GetPlayerPolicyResponseOutput.cs │ │ ├── GetPolicyResponseOutput.cs │ │ └── NewProjectAccessFile.cs │ ├── Service │ │ ├── AccessEndpoints.cs │ │ ├── AccessService.cs │ │ └── IAccessService.cs │ └── Unity.Services.Cli.Access.csproj ├── Unity.Services.Cli.Authoring.UnitTest │ ├── Compression │ │ └── ZipArchiverTests.cs │ ├── DeployModuleTests.cs │ ├── DeploymentDefinition │ │ ├── CliDeploymentDefinitionServiceTests.cs │ │ ├── DeploymentDefinitionFileIntersectionExceptionTests.cs │ │ └── DeploymentDefinitionFileServiceTests.cs │ ├── Export │ │ └── BaseExporterTests.cs │ ├── Handlers │ │ ├── AuthoringCommandHandlerTests.cs │ │ ├── DeployHandlerTests.cs │ │ ├── FetchHandlerTests.cs │ │ └── NewFileHandlerTests.cs │ ├── Import │ │ └── BaseImportTests.cs │ ├── Model │ │ ├── DeploymentResultTests.cs │ │ ├── FetchResultTests.cs │ │ └── TableOutput │ │ │ └── TableTests.cs │ ├── Service │ │ └── DeployFileServiceTests.cs │ └── Unity.Services.Cli.Authoring.UnitTest.csproj ├── Unity.Services.Cli.Authoring │ ├── Compression │ │ ├── IZipArchiver.cs │ │ ├── ZipArchiver.cs │ │ └── ZipEntryStream.cs │ ├── DeployModule.cs │ ├── DeploymentDefinition │ │ ├── CliDeploymentDefinition.cs │ │ ├── CliDeploymentDefinitionService.cs │ │ ├── DeploymentDefinitionFactory.cs │ │ ├── DeploymentDefinitionFileIntersectionException.cs │ │ ├── DeploymentDefinitionFileService.cs │ │ ├── DeploymentDefinitionFiles.cs │ │ ├── DeploymentDefinitionFilteringResult.cs │ │ ├── DeploymentDefinitionInputResult.cs │ │ ├── ICliDeploymentDefinitionService.cs │ │ ├── IDeploymentDefinitionFactory.cs │ │ ├── IDeploymentDefinitionFileService.cs │ │ ├── IDeploymentDefinitionFiles.cs │ │ ├── IDeploymentDefinitionFilteringResult.cs │ │ └── MultipleDeploymentDefinitionInDirectoryException.cs │ ├── Exceptions │ │ ├── DeployException.cs │ │ ├── InvalidExtensionException.cs │ │ └── PathNotFoundException.cs │ ├── Export │ │ ├── BaseExporter.cs │ │ ├── ExportState.cs │ │ ├── IExporter.cs │ │ └── Input │ │ │ └── ExportInput.cs │ ├── FetchModule.cs │ ├── Handlers │ │ ├── AuthoringHandlerCommon.cs │ │ ├── DeployCommandHandler.cs │ │ ├── FetchCommandHandler.cs │ │ └── NewFileHandler.cs │ ├── Import │ │ ├── BaseImporter.cs │ │ ├── IImporter.cs │ │ ├── ImportState.cs │ │ └── Input │ │ │ └── ImportInput.cs │ ├── Input │ │ ├── AuthoringInput.cs │ │ ├── DeployInput.cs │ │ ├── DryRunInput.cs │ │ ├── FetchInput.cs │ │ └── NewFileInput.cs │ ├── Model │ │ ├── AuthorResult.cs │ │ ├── AuthoringResultServiceTask.cs │ │ ├── DeployContent.cs │ │ ├── DeploymentResult.cs │ │ ├── FetchResult.cs │ │ ├── ImportExportEntry.cs │ │ ├── ImportExportResult.cs │ │ ├── Statuses.cs │ │ └── TableOutput │ │ │ ├── RowContent.cs │ │ │ └── TableContent.cs │ ├── Service │ │ ├── DeployFileService.cs │ │ ├── IAuthoringService.cs │ │ ├── ICliDeploymentOutputHandler.cs │ │ ├── IDeployFileService.cs │ │ ├── IDeploymentService.cs │ │ └── IFetchService.cs │ ├── Templates │ │ └── IFileTemplate.cs │ ├── Unity.Services.Cli.Authoring.csproj │ └── Utils │ │ └── ImportExportUtils.cs ├── Unity.Services.Cli.CloudCode.UnitTest │ ├── Authoring │ │ ├── Clients │ │ │ ├── CloudCodeModuleClientTests.cs │ │ │ └── CloudCodeScriptClientTests.cs │ │ ├── Fetch │ │ │ ├── JavaScriptFetchHandlerTests.cs │ │ │ └── JavaScriptFetchServiceTests.cs │ │ └── Utils │ │ │ ├── CloudCodeParameterExtensionsTests.cs │ │ │ ├── CloudCodeScriptNameComparerTests.cs │ │ │ ├── ScriptDuplicateUtilsTests.cs │ │ │ └── ScriptExtensionsTests.cs │ ├── CloudCodeModuleTests.cs │ ├── Deploy │ │ ├── CloudCodeAuthoringLoggerTests.cs │ │ ├── CloudCodeModuleDeploymentServiceTests.cs │ │ ├── CloudCodeModuleDownloaderTests.cs │ │ ├── CloudCodeModuleLoaderTests.cs │ │ ├── CloudCodeScriptDeploymentServiceTests.cs │ │ ├── CloudCodeScriptsLoaderTests.cs │ │ ├── CustomCloudCodeDeploymentHandlerTests.cs │ │ ├── ExposeCliCloudCodeDeploymentHandler.cs │ │ └── ScriptParameterExtensionTests.cs │ ├── Handlers │ │ ├── CreateHandlerTests.cs │ │ ├── DeleteHandlerTests.cs │ │ ├── DeleteModuleHandlerTests.cs │ │ ├── ExportModulesHandlerTests.cs │ │ ├── ExportScriptsHandlerTests.cs │ │ ├── GetHandlerTests.cs │ │ ├── GetModuleHandlerTests.cs │ │ ├── ImportModulesHandlerTests.cs │ │ ├── ImportScriptsHandlerTests.cs │ │ ├── ListHandlerTests.cs │ │ ├── ListModuleHandlerTests.cs │ │ ├── PublishHandlerTests.cs │ │ └── UpdateHandlerTests.cs │ ├── IO │ │ ├── AssemblyLoaderTests.cs │ │ ├── CloudCodeFileStreamTests.cs │ │ └── FileSystemTests.cs │ ├── Mock │ │ ├── CloudCodeApiV1AsyncMock.cs │ │ └── MockCloudCodeDeploymentHandler.cs │ ├── Model │ │ ├── OutputScriptTests.cs │ │ └── TestableScriptList.cs │ ├── ModuleTestCases │ │ ├── Module.ccm │ │ └── test.ccmzip │ ├── Parameters │ │ ├── CloudCodeScriptParserTests.cs │ │ └── CloudScriptParametersParserTests.cs │ ├── ScriptTestCases │ │ ├── Import │ │ │ └── test.jszip │ │ ├── JS │ │ │ ├── AsyncOperation.js │ │ │ ├── AsyncOperation.json │ │ │ ├── BigInt.js │ │ │ ├── CyclicReference.js │ │ │ ├── HugeFile.js │ │ │ ├── HugeFile.json │ │ │ ├── InfiniteLoop.js │ │ │ ├── MemoryAllocation.js │ │ │ ├── MixedValue.js │ │ │ ├── MixedValueParam.json │ │ │ ├── NoParameter.js │ │ │ ├── ParamInvalidRequired.json │ │ │ ├── ParamInvalidType.json │ │ │ ├── QuotedString.js │ │ │ ├── QuotedString.json │ │ │ ├── ReadFile.js │ │ │ ├── Required.js │ │ │ ├── RequiredInvalidParam.js │ │ │ ├── RequiredParam.json │ │ │ ├── Script.js │ │ │ └── ScriptParam.json │ │ ├── ParamTestCase.cs │ │ ├── ScriptTestCase.cs │ │ └── TestResourceReader.cs │ ├── Service │ │ ├── CloudCodeInputParserTests.cs │ │ └── CloudCodeServiceTests.cs │ ├── Solution │ │ └── FileContentRetrieverTests.cs │ ├── Unity.Services.Cli.CloudCode.UnitTest.csproj │ └── Utils │ │ ├── CloudCodeScriptParserExtensionsTests.cs │ │ ├── IoUtilsTests.cs │ │ └── TestValues.cs ├── Unity.Services.Cli.CloudCode │ ├── Authoring │ │ ├── Clients │ │ │ ├── CloudCodeModuleClient.cs │ │ │ ├── CloudCodeScriptClient.cs │ │ │ ├── ICSharpClient.cs │ │ │ ├── ICliCloudCodeClient.cs │ │ │ └── IJavaScriptClient.cs │ │ ├── Fetch │ │ │ ├── IJavaScriptFetchHandler.cs │ │ │ ├── JavaScriptFetchHandler.cs │ │ │ └── JavaScriptFetchService.cs │ │ └── Utils │ │ │ ├── CloudCodeParameterExtensions.cs │ │ │ ├── CloudCodeScriptNameComparer.cs │ │ │ ├── ScriptDuplicateUtils.cs │ │ │ └── ScriptExtensions.cs │ ├── CloudCodeModule.cs │ ├── Deploy │ │ ├── CliCloudCodeDeploymentHandler.cs │ │ ├── CloudCodeAuthoringLogger.cs │ │ ├── CloudCodeModule.cs │ │ ├── CloudCodeModuleDeploymentService.cs │ │ ├── CloudCodeModulesDownloader.cs │ │ ├── CloudCodeModulesLoader.cs │ │ ├── CloudCodeScript.cs │ │ ├── CloudCodeScriptDeploymentService.cs │ │ ├── CloudCodeScriptLoadResult.cs │ │ ├── CloudCodeScriptsLoader.cs │ │ ├── EnvironmentProvider.cs │ │ ├── ICliEnvironmentProvider.cs │ │ ├── ICloudCodeModulesDownloader.cs │ │ ├── ICloudCodeModulesLoader.cs │ │ ├── ICloudCodeScriptsLoader.cs │ │ ├── ModuleDeployContent.cs │ │ ├── NoopDeploymentAnalytics.cs │ │ ├── ScriptNameJsonConverter.cs │ │ └── ScriptParameterExtension.cs │ ├── Exceptions │ │ └── ScriptEvaluationException.cs │ ├── Handlers │ │ ├── CreateHandler.cs │ │ ├── DeleteHandler.cs │ │ ├── DeleteModuleHandler.cs │ │ ├── GetHandler.cs │ │ ├── GetModuleHandler.cs │ │ ├── ImportExport │ │ │ ├── Modules │ │ │ │ ├── CloudCodeModulesExporter.cs │ │ │ │ ├── CloudCodeModulesImporter.cs │ │ │ │ ├── ModuleExportHandler.cs │ │ │ │ └── ModulesImportHandler.cs │ │ │ └── Scripts │ │ │ │ ├── CloudCodeScriptsExporter.cs │ │ │ │ ├── CloudCodeScriptsImporter.cs │ │ │ │ ├── ExportHandler.cs │ │ │ │ ├── ImportExportUtils.cs │ │ │ │ ├── ImportHandler.cs │ │ │ │ └── ScriptExportHandler.cs │ │ ├── ListHandler.cs │ │ ├── ListModulesHandler.cs │ │ ├── NewFile │ │ │ └── NewFileModuleHandler.cs │ │ ├── PublishHandler.cs │ │ └── UpdateHandler.cs │ ├── IO │ │ ├── AssemblyLoader.cs │ │ ├── CloudCodeFileStream.cs │ │ ├── FileSystem.cs │ │ └── IAssemblyLoader.cs │ ├── Input │ │ └── CloudCodeInput.cs │ ├── JavaScripts │ │ ├── script_parameters.js │ │ └── script_template.js │ ├── Model │ │ ├── ActiveScriptOutput.cs │ │ ├── ApiJsonProblem.cs │ │ ├── CloudListModuleResult.cs │ │ ├── CloudListScriptResult.cs │ │ ├── DeletedCloudCode.cs │ │ ├── GetModuleResponseOutput.cs │ │ ├── GetScriptResponseOutput.cs │ │ └── ParseScriptParametersResult.cs │ ├── Parameters │ │ ├── CloudCodeScriptParser.cs │ │ ├── CloudScriptParametersParser.cs │ │ ├── ICloudCodeScriptParser.cs │ │ └── ICloudScriptParametersParser.cs │ ├── Service │ │ ├── CloudCodeInputParser.cs │ │ ├── CloudCodeService.cs │ │ ├── ICloudCodeInputParser.cs │ │ └── ICloudCodeService.cs │ ├── Solution │ │ ├── FileContentRetriever.cs │ │ └── TemplateInfo.cs │ ├── Templates │ │ └── CloudCodeTemplate.cs │ ├── Unity.Services.Cli.CloudCode.csproj │ └── Utils │ │ ├── CloudCodeCliDotnetRunner.cs │ │ ├── CloudCodeConstants.cs │ │ ├── CloudCodeScriptParserExtensions.cs │ │ └── IoUtils.cs ├── Unity.Services.Cli.CloudContentDelivery.UnitTest │ ├── CloudContentDeliveryModuleTests.cs │ ├── CloudContentDeliveryTestsConstants.cs │ ├── Handlers │ │ ├── Badges │ │ │ ├── CreateBadgeHandlerTests.cs │ │ │ ├── DeleteBadgeHandlerTests.cs │ │ │ └── ListBadgeHandlerTests.cs │ │ ├── Buckets │ │ │ ├── CreateBucketHandlerTests.cs │ │ │ ├── DeleteBucketHandlerTests.cs │ │ │ ├── GetBucketHandlerTests.cs │ │ │ ├── ListBucketHandlerTests.cs │ │ │ ├── PermissionBucketHandlerTests.cs │ │ │ ├── PromoteBucketHandlerTests.cs │ │ │ └── PromotionBucketHandlerTests.cs │ │ └── Entries │ │ │ ├── CopyEntryHandlerTests.cs │ │ │ ├── DeleteEntryHandlerTests.cs │ │ │ ├── DownloadEntryHandlerTests.cs │ │ │ ├── GetEntryHandlerTests.cs │ │ │ ├── ListEntryHandlerTests.cs │ │ │ ├── SyncEntryHandlerTests.cs │ │ │ └── UpdateEntryHandlerTests.cs │ ├── Models │ │ └── ModelsTests.cs │ ├── Service │ │ ├── BadgeClientTests.cs │ │ ├── BucketClientTests.cs │ │ ├── ContentDeliveryValidatorTests.cs │ │ ├── EntryClientTests.cs │ │ ├── ReleaseClientTests.cs │ │ ├── SynchronizationServiceTests.cs │ │ └── UploadContentClientTests.cs │ ├── Unity.Services.Cli.CloudContentDelivery.UnitTest.csproj │ └── Utils │ │ └── CcdUtilsTests.cs ├── Unity.Services.Cli.CloudContentDelivery │ ├── CloudContentDeliveryModule.cs │ ├── Exceptions │ │ └── CloudContentDeliveryException.cs │ ├── Fetch │ │ └── CloudContentDeliveryFetchService.cs │ ├── Handlers │ │ ├── Badges │ │ │ ├── CreateBadgeHandler.cs │ │ │ ├── DeleteBadgeHandler.cs │ │ │ └── ListBadgeHandler.cs │ │ ├── Buckets │ │ │ ├── CreateBucketHandler.cs │ │ │ ├── DeleteBucketHandler.cs │ │ │ ├── GetBucketHandler.cs │ │ │ ├── ListBucketHandler.cs │ │ │ ├── PermissionBucketHandler.cs │ │ │ ├── PromoteBucketHandler.cs │ │ │ └── PromotionBucketHandler.cs │ │ └── Entries │ │ │ ├── CopyEntryHandler.cs │ │ │ ├── DeleteEntryHandler.cs │ │ │ ├── DownloadEntryHandler.cs │ │ │ ├── GetEntryHandler.cs │ │ │ ├── ListEntryHandler.cs │ │ │ ├── SyncEntryHandler.cs │ │ │ └── UpdateEntryHandler.cs │ ├── IO │ │ └── FileSystem.cs │ ├── Input │ │ ├── CloudContentDeliveryInput.cs │ │ └── CloudContentDeliveryInputBuckets.cs │ ├── Model │ │ ├── BadgeResult.cs │ │ ├── BucketResult.cs │ │ ├── EntryResult.cs │ │ ├── ListBadgeResult.cs │ │ ├── ListBucketResult.cs │ │ ├── ListEntryResult.cs │ │ ├── ListReleaseResult.cs │ │ ├── LongOperationSummary.cs │ │ ├── PermissionResult.cs │ │ ├── PromoteResult.cs │ │ ├── PromotionResult.cs │ │ ├── ReleaseResult.cs │ │ ├── SharedRateLimitStatus.cs │ │ ├── ShortOperationSummary.cs │ │ ├── SyncEntry.cs │ │ └── SyncResult.cs │ ├── Service │ │ ├── BadgeClient.cs │ │ ├── BucketClient.cs │ │ ├── ClientWrapper.cs │ │ ├── ContentDeliveryValidator.cs │ │ ├── EntryClient.cs │ │ ├── IBadgeClient.cs │ │ ├── IBucketClient.cs │ │ ├── IClientWrapper.cs │ │ ├── IContentDeliveryValidator.cs │ │ ├── IEntryClient.cs │ │ ├── IOperationSummary.cs │ │ ├── IReleaseClient.cs │ │ ├── ISynchronizationService.cs │ │ ├── IUploadContentClient.cs │ │ ├── ReleaseClient.cs │ │ ├── SynchronizationService.cs │ │ └── UploadContentClient.cs │ ├── Unity.Services.Cli.CloudContentDelivery.csproj │ └── Utils │ │ └── CcdUtils.cs ├── Unity.Services.Cli.CloudSave.UnitTest │ ├── Authoring │ │ ├── CloudSaveDeploymentServiceTests.cs │ │ └── CloudSaveFetchServiceTests.cs │ ├── CloudSaveModuleTests.cs │ ├── Core │ │ ├── CloudSaveDeployFetchTestBase.cs │ │ ├── CloudSaveDeploymentHandlerTests.cs │ │ └── CloudSaveFetchHandlerTests.cs │ ├── Handlers │ │ ├── CreateCustomIndexHandlerTests.cs │ │ ├── CreatePlayerIndexHandlerTests.cs │ │ ├── ListCustomIdsHandlerTests.cs │ │ ├── ListIndexesHandlerTests.cs │ │ ├── ListPlayerIdsHandlerTests.cs │ │ ├── QueryCustomDataHandlerTests.cs │ │ └── QueryPlayerDataHandlerTests.cs │ ├── Service │ │ └── CloudSaveDataServiceTests.cs │ ├── Unity.Services.Cli.CloudSave.UnitTest.csproj │ └── Utils │ │ └── TestValues.cs ├── Unity.Services.Cli.CloudSave │ ├── CloudSaveModule.cs │ ├── Deploy │ │ ├── CloudSaveClient.cs │ │ ├── CloudSaveDeploymentService.cs │ │ └── SimpleResourceConfigFile.cs │ ├── Exceptions │ │ └── CloudSaveException.cs │ ├── Fetch │ │ └── CloudSaveFetchService.cs │ ├── Handlers │ │ ├── CreateCustomIndexHandler.cs │ │ ├── CreatePlayerIndexHandler.cs │ │ ├── ListCustomDataIdsHandler.cs │ │ ├── ListIndexesHandler.cs │ │ ├── ListPlayerDataIdsHandler.cs │ │ ├── QueryCustomDataHandler.cs │ │ ├── QueryPlayerDataHandler.cs │ │ └── RequestBodyHandler.cs │ ├── IO │ │ ├── CloudSaveSimpleResourceLoader.cs │ │ └── FileSystem.cs │ ├── Input │ │ ├── CreateIndexInput.cs │ │ ├── ListDataIdsInput.cs │ │ └── QueryDataInput.cs │ ├── Models │ │ ├── CreateIndexOutput.cs │ │ └── ListIndexesOutput.cs │ ├── Service │ │ ├── CloudSaveDataService.cs │ │ └── ICloudSaveDataService.cs │ ├── Unity.Services.Cli.CloudSave.csproj │ └── Utils │ │ ├── CustomIndexVisibilityTypes.cs │ │ └── PlayerIndexVisibilityTypes.cs ├── Unity.Services.Cli.Common.UnitTest │ ├── Batching │ │ └── BatchingTests.cs │ ├── CommandLineBuilderHelperTests.cs │ ├── CommandModuleTests.cs │ ├── CommonModuleTests.cs │ ├── ConfigurationModuleTests.cs │ ├── Console │ │ ├── CliPromptTest.cs │ │ ├── ConsoleTableTests.cs │ │ ├── LoadingIndicatorTests.cs │ │ ├── MockLoadingExclusiveMode.cs │ │ ├── MockProgressExclusiveMode.cs │ │ └── ProgressBarTests.cs │ ├── Exceptions │ │ └── ExceptionHelperTests.cs │ ├── Handlers │ │ ├── DeleteHandlerTests.cs │ │ ├── GetHandlerTests.cs │ │ └── SetHandlerTests.cs │ ├── Input │ │ └── TestInput.cs │ ├── Logging │ │ ├── JsonLoggerTests.cs │ │ ├── LogCacheTests.cs │ │ ├── LogFormatter │ │ │ ├── JsonLogFormatterTests.cs │ │ │ └── LogFormatterTests.cs │ │ ├── LogMessageTestHelper.cs │ │ └── LoggerTests.cs │ ├── Middleware │ │ └── ContextBinderTests.cs │ ├── Models │ │ └── DummyModule.cs │ ├── Networking │ │ ├── EndpointHelperTests.cs │ │ └── RequestHeaderHelperTests.cs │ ├── Persister │ │ └── JsonFilePersisterTests.cs │ ├── Policies │ │ └── RetryPolicyTests.cs │ ├── Process │ │ └── CliProcessTests.cs │ ├── Service │ │ └── ConfigurationServiceTests.cs │ ├── Services │ │ └── ServiceTypesBridgeTests.cs │ ├── SystemEnvironment │ │ └── SystemEnvironmentUtilitiesTests.cs │ ├── Telemetry │ │ ├── AnalyticsEventBuilderTests.cs │ │ ├── MetricsUtilsTests.cs │ │ └── TelemetryTests.cs │ ├── Unity.Services.Cli.Common.UnitTest.csproj │ ├── Utils │ │ └── ReflectionHelperTests.cs │ └── Validator │ │ └── ConfigurationValidatorTests.cs ├── Unity.Services.Cli.Common │ ├── Batching │ │ └── Batching.cs │ ├── Binding │ │ ├── HandlerHelper.cs │ │ └── ServiceBinder.cs │ ├── CommandLineBuilderHelper.cs │ ├── CommonModule.cs │ ├── Configuration │ │ ├── ConfigurationModule.cs │ │ ├── Handlers │ │ │ ├── DeleteHandler.cs │ │ │ ├── GetHandler.cs │ │ │ └── SetHandler.cs │ │ ├── Models │ │ │ ├── Configuration.cs │ │ │ └── Keys.cs │ │ ├── Service │ │ │ ├── ConfigurationService.cs │ │ │ └── IConfigurationService.cs │ │ └── Validator │ │ │ ├── ConfigurationValidator.cs │ │ │ └── IConfigurationValidator.cs │ ├── Console │ │ ├── ConsolePrompt.cs │ │ ├── ConsoleTable.cs │ │ ├── IConsolePrompt.cs │ │ ├── IConsoleTable.cs │ │ ├── ILoadingIndicator.cs │ │ ├── IProgressBar.cs │ │ ├── LoadingIndicator.cs │ │ └── ProgressBar.cs │ ├── Exceptions │ │ ├── CliException.cs │ │ ├── ConfigValidationException.cs │ │ ├── DeploymentFailureException.cs │ │ ├── EnvironmentNotFoundException.cs │ │ ├── ExceptionHelper.cs │ │ ├── ExitCode.cs │ │ └── MissingConfigurationException.cs │ ├── ICommandModule.cs │ ├── IO │ │ └── FileSystem.cs │ ├── Input │ │ ├── CommonInput.cs │ │ ├── ConfigBindingAttribute.cs │ │ ├── ConfigurationInput.cs │ │ └── InputBindingAttribute.cs │ ├── Logging │ │ ├── JsonLogMessage.cs │ │ ├── LogCache.cs │ │ ├── LogConfiguration.cs │ │ ├── LogFormatter │ │ │ ├── ILogFormatter.cs │ │ │ ├── JsonLogFormatter.cs │ │ │ └── LogFormatter.cs │ │ ├── LogMessage.cs │ │ ├── Logger.cs │ │ ├── LoggerExtension.cs │ │ └── LoggerProvider.cs │ ├── Middleware │ │ └── ContextBinder.cs │ ├── Networking │ │ ├── CliNetworkEnvironment.cs │ │ ├── EndpointHelper.cs │ │ ├── Endpoints │ │ │ ├── CloudCodeEndpoints.cs │ │ │ ├── CloudContentDeliveryEndpoints.cs │ │ │ ├── CloudSaveEndpoints.cs │ │ │ ├── LeaderboardEndpoints.cs │ │ │ ├── LobbyApiEndpoints.cs │ │ │ ├── NetworkTargetEndpoints.cs │ │ │ ├── RemoteConfigEndpoints.cs │ │ │ ├── SchedulerEndpoints.cs │ │ │ ├── TelemetryApiEndpoints.cs │ │ │ ├── TriggersEndpoints.cs │ │ │ └── UnityServicesGatewayEndpoints.cs │ │ └── RequestHeaderHelper.cs │ ├── Persister │ │ ├── IPersister.cs │ │ └── JsonFilePersister.cs │ ├── Policies │ │ └── RetryPolicy.cs │ ├── Process │ │ ├── CliProcess.cs │ │ ├── ICliProcess.cs │ │ ├── ProcessException.cs │ │ └── ProcessExtensions.cs │ ├── Services │ │ ├── IServiceTypeList.cs │ │ └── ServiceTypesBridge.cs │ ├── SystemEnvironment │ │ ├── EnvironmentBindingAttribute.cs │ │ ├── ISystemEnvironmentProvider.cs │ │ └── SystemEnvironmentProvider.cs │ ├── Telemetry │ │ ├── AnalyticEvent │ │ │ ├── AnalyticEvent.cs │ │ │ ├── AnalyticEventFactory │ │ │ │ ├── AnalyticEventFactory.cs │ │ │ │ └── IAnalyticEventFactory.cs │ │ │ ├── AnalyticEventUtils.cs │ │ │ ├── AnalyticsEventBuilder.cs │ │ │ ├── IAnalyticEvent.cs │ │ │ └── IAnalyticsEventBuilder.cs │ │ ├── DiagnosticsTagKeys.cs │ │ ├── MetricTagKeys.cs │ │ ├── TagKeys.cs │ │ ├── TelemetryConfigurationProvider.cs │ │ └── TelemetrySender.cs │ ├── Unity.Services.Cli.Common.csproj │ └── Utils │ │ ├── CommandTreePrinter.cs │ │ ├── IUnityEnvironment.cs │ │ ├── ReflectionHelper.cs │ │ └── ResourceFileHelper.cs ├── Unity.Services.Cli.Economy.UnitTest │ ├── Authoring │ │ ├── Deploy │ │ │ └── EconomyDeploymentServiceTests.cs │ │ ├── EconomyClientTests.cs │ │ ├── EconomyResourcesLoaderTests.cs │ │ └── Fetch │ │ │ └── EconomyFetchServiceTests.cs │ ├── EconomyModuleTests.cs │ ├── Handlers │ │ ├── DeleteHandlerTests.cs │ │ ├── EconomyConfigurationBuilderTests.cs │ │ ├── GetPublishedHandlerTests.cs │ │ ├── GetResourcesHandlerTests.cs │ │ └── PublishHandlerTests.cs │ ├── Mock │ │ └── EconomyApiV2AsyncMock.cs │ ├── Service │ │ └── EconomyServiceTests.cs │ ├── Unity.Services.Cli.Economy.UnitTest.csproj │ └── Utils │ │ └── TestValues.cs ├── Unity.Services.Cli.Economy │ ├── AssemblyInfo.cs │ ├── Authoring │ │ ├── Constants.cs │ │ ├── Deploy │ │ │ ├── CliEconomyDeploymentHandler.cs │ │ │ └── EconomyDeploymentService.cs │ │ ├── EconomyAuthoringLogger.cs │ │ ├── EconomyClient.cs │ │ ├── EconomyResourcesLoader.cs │ │ ├── Fetch │ │ │ └── EconomyFetchService.cs │ │ ├── ICliEconomyClient.cs │ │ └── IO │ │ │ ├── EconomyJsonConverter.cs │ │ │ └── FileSystem.cs │ ├── EconomyModule.cs │ ├── Exceptions │ │ └── InvalidResourceException.cs │ ├── Handlers │ │ ├── DeleteHandler.cs │ │ ├── EconomyConfigurationBuilder.cs │ │ ├── GetPublishedHandler.cs │ │ ├── GetResourcesHandler.cs │ │ └── PublishHandler.cs │ ├── Input │ │ └── EconomyInput.cs │ ├── Model │ │ ├── EconomyResourcesResponseResult.cs │ │ └── Resource.cs │ ├── Service │ │ ├── EconomyService.cs │ │ └── IEconomyService.cs │ ├── Templates │ │ ├── EconomyCurrencyFile.cs │ │ ├── EconomyInventoryItemFile.cs │ │ ├── EconomyRealMoneyPurchaseFile.cs │ │ ├── EconomyResourceFile.cs │ │ ├── EconomyVirtualPurchaseFile.cs │ │ └── IEconomyResourceFile.cs │ ├── Unity.Services.Cli.Economy.csproj │ └── Utils │ │ └── EconomyResourceTypes.cs ├── Unity.Services.Cli.Environment.UnitTest │ ├── EnvironmentModuleTests.cs │ ├── EnvironmentServiceTests.cs │ ├── Handlers │ │ ├── AdditionHandlerTests.cs │ │ ├── DeletionHandlerTests.cs │ │ ├── ListHandlerTests.cs │ │ └── UseHandlerTests.cs │ ├── Mock │ │ └── IdentityApiV1AsyncMock.cs │ ├── Unity.Services.Cli.Environment.UnitTest.csproj │ └── UnityEnvironmentTests.cs ├── Unity.Services.Cli.Environment │ ├── EnvironmentModule.cs │ ├── Handlers │ │ ├── AdditionHandler.cs │ │ ├── DeletionHandler.cs │ │ ├── ListHandler.cs │ │ └── UseHandler.cs │ ├── Input │ │ └── EnvironmentInput.cs │ ├── Service │ │ ├── EnvironmentService.cs │ │ ├── IEnvironmentService.cs │ │ └── UnityEnvironment.cs │ └── Unity.Services.Cli.Environment.csproj ├── Unity.Services.Cli.GameServerHosting.UnitTest │ ├── GameServerHostingModuleTests.cs │ ├── GameServerHostingUnitTestsConstants.cs │ ├── Handlers │ │ ├── BuildConfigurationCreateHandlerTests.cs │ │ ├── BuildConfigurationDeleteHandlerTests.cs │ │ ├── BuildConfigurationGetHandlerTests.cs │ │ ├── BuildConfigurationListHandlerTests.cs │ │ ├── BuildConfigurationUpdateHandlerTests.cs │ │ ├── BuildCreateHandlerTests.cs │ │ ├── BuildCreateVersionBucketHandlerTests.cs │ │ ├── BuildCreateVersionContainerHandlerTests.cs │ │ ├── BuildCreateVersionFileUploadHandlerTests.cs │ │ ├── BuildCreateVersionGCSHandlerTests.cs │ │ ├── BuildCreateVersionHandlerTests.cs │ │ ├── BuildDeleteHandlerTests.cs │ │ ├── BuildGetHandlerTests.cs │ │ ├── BuildInstallsHandlerTests.cs │ │ ├── BuildListHandlerTests.cs │ │ ├── BuildUpdateHandlerTests.cs │ │ ├── CoreDumpCreateHandlerTest.cs │ │ ├── CoreDumpDeleteHandlerTest.cs │ │ ├── CoreDumpGetHandlerTest.cs │ │ ├── CoreDumpUpdateHandlerTest.cs │ │ ├── FileDownloadHandlerTests.cs │ │ ├── FileListHandlerTests.cs │ │ ├── FleetCreateHandlerTests.cs │ │ ├── FleetDeleteHandlerTests.cs │ │ ├── FleetGetHandlerTests.cs │ │ ├── FleetListHandlerTests.cs │ │ ├── FleetRegionCreateHandlerTests.cs │ │ ├── FleetRegionUpdateHandlerTests.cs │ │ ├── FleetUpdateHandlerTests.cs │ │ ├── HandlerCommon.cs │ │ ├── MachineListHandlerTests.cs │ │ ├── RegionAvailableHandlerTests.cs │ │ ├── RegionTemplatesHandlerTests.cs │ │ ├── ServerGetHandlerTests.cs │ │ └── ServerListHandlerTests.cs │ ├── Input │ │ ├── BuildConfigurationIdInputTests.cs │ │ ├── BuildConfigurationListInputTests.cs │ │ ├── BuildCreateInputTests.cs │ │ ├── BuildIdInputTests.cs │ │ ├── CoreDumpCreateInputTest.cs │ │ ├── FileDownloadInputTests.cs │ │ ├── FileListInputTests.cs │ │ ├── FleetCreateInputTests.cs │ │ ├── FleetIdInputTests.cs │ │ ├── FleetUpdateInputTests.cs │ │ ├── MachineListInputTests.cs │ │ ├── ServerIdInputTests.cs │ │ └── ServerListInputTests.cs │ ├── Mocks │ │ ├── GameServerHostingBuildApiV1AsyncMock.cs │ │ ├── GameServerHostingBuildConfigurationsApiV1Mock.cs │ │ ├── GameServerHostingCoreDumpApiV1Mock.cs │ │ ├── GameServerHostingFilesApiV1Mock.cs │ │ ├── GameServerHostingFleetsApiV1Mock.cs │ │ ├── GameServerHostingMachinesApiV1Mock.cs │ │ └── GameServerHostingServersApiV1Mock.cs │ ├── Model │ │ ├── BuildConfigurationOutputTests.cs │ │ ├── BuildInstallsItemFailuresItemOutputTests.cs │ │ ├── BuildInstallsItemFailuresOutputTests.cs │ │ ├── BuildInstallsItemOutputTests.cs │ │ ├── BuildInstallsItemRegionsItemOutputTests.cs │ │ ├── BuildInstallsItemRegionsOutputTests.cs │ │ ├── BuildInstallsOutputTests.cs │ │ ├── BuildListOutputTests.cs │ │ ├── BuildOutputTests.cs │ │ ├── CcdOutputTests.cs │ │ ├── CoreDumpOutputTest.cs │ │ ├── FilesItemFleetOutputTests.cs │ │ ├── FilesItemMachineOutputTests.cs │ │ ├── FilesItemOutputTests.cs │ │ ├── FilesOutputTests.cs │ │ ├── FleetGetOutputTests.cs │ │ ├── FleetListItemOutputTests.cs │ │ ├── FleetListOutputTests.cs │ │ ├── FleetRegionCreateOutputTests.cs │ │ ├── FleetRegionUpdateOutputTests.cs │ │ ├── MachinesItemOutputTests.cs │ │ ├── MachinesItemServerStatsOutputTests.cs │ │ ├── MachinesItemSpecOutputTests.cs │ │ ├── MachinesOutputTests.cs │ │ ├── RegionListOutputTests.cs │ │ ├── RegionOutputTests.cs │ │ ├── RegionTemplateListOutputTests.cs │ │ ├── ServerGetOutputTests.cs │ │ ├── ServersItemOutputTests.cs │ │ └── ServersOutputTests.cs │ ├── Service │ │ └── GameServerHostingServiceTests.cs │ ├── Services │ │ ├── ApiClientFactoryTests.cs │ │ ├── ApiExceptionConverterTest.cs │ │ ├── BuildClientTests.cs │ │ ├── BuildConfigsClientTests.cs │ │ ├── CcdCloudStorageTests.cs │ │ ├── CcdHashExtensionsTests.cs │ │ ├── CoreDumpStateConverterTest.cs │ │ ├── DeployFileServiceTests.cs │ │ ├── DummyBinaryBuilderTests.cs │ │ ├── FileReaderAdapterTests.cs │ │ ├── FleetsClientTests.cs │ │ ├── GameServerHostingConfigLoaderTests.cs │ │ └── GcsCredentialParserTest.cs │ ├── Unity.Services.Cli.GameServerHosting.UnitTest.csproj │ └── Usings.cs ├── Unity.Services.Cli.GameServerHosting │ ├── Endpoints │ │ └── CloudContentDeliveryEndpoints.cs │ ├── Exceptions │ │ ├── DuplicateResourceException.cs │ │ ├── InvalidConfigException.cs │ │ ├── InvalidExtensionException.cs │ │ ├── InvalidIdsListException.cs │ │ ├── InvalidKeyValuePairException.cs │ │ ├── InvalidLegacyInputUsageException.cs │ │ ├── InvalidResponseException.cs │ │ ├── MissingInputException.cs │ │ ├── PathNotFoundException.cs │ │ └── SyncFailedException.cs │ ├── GameServerHostingFeatures.cs │ ├── GameServerHostingModule.cs │ ├── Handlers │ │ ├── BuildConfigurationCreateHandler.cs │ │ ├── BuildConfigurationDeleteHandler.cs │ │ ├── BuildConfigurationGetHandler.cs │ │ ├── BuildConfigurationListHandler.cs │ │ ├── BuildConfigurationUpdateHandler.cs │ │ ├── BuildCreateHandler.cs │ │ ├── BuildCreateVersionContainerHandler.cs │ │ ├── BuildCreateVersionFileUploadHandler.cs │ │ ├── BuildCreateVersionGCSHandler.cs │ │ ├── BuildCreateVersionHandler.cs │ │ ├── BuildCreateVersionS3Handler.cs │ │ ├── BuildDeleteHandler.cs │ │ ├── BuildGetHandler.cs │ │ ├── BuildInstallsHandler.cs │ │ ├── BuildListHandler.cs │ │ ├── BuildUpdateHandler.cs │ │ ├── CoreDumpCreateHandler.cs │ │ ├── CoreDumpDeleteHandler.cs │ │ ├── CoreDumpGetHandler.cs │ │ ├── CoreDumpUpdateHandler.cs │ │ ├── FileDownloadHandler.cs │ │ ├── FileListHandler.cs │ │ ├── FleetCreateHandler.cs │ │ ├── FleetDeleteHandler.cs │ │ ├── FleetGetHandler.cs │ │ ├── FleetListHandler.cs │ │ ├── FleetRegionCreateHandler.cs │ │ ├── FleetRegionUpdateHandler.cs │ │ ├── FleetUpdateHandler.cs │ │ ├── MachineListHandler.cs │ │ ├── RegionAvailableHandler.cs │ │ ├── RegionTemplatesHandler.cs │ │ ├── ServerGetHandler.cs │ │ └── ServerListHandler.cs │ ├── Input │ │ ├── BuildConfigurationCreateInput.cs │ │ ├── BuildConfigurationIdInput.cs │ │ ├── BuildConfigurationListInput.cs │ │ ├── BuildConfigurationUpdateInput.cs │ │ ├── BuildCreateInput.cs │ │ ├── BuildCreateVersionInput.cs │ │ ├── BuildIdInput.cs │ │ ├── BuildUpdateInput.cs │ │ ├── CoreDumpCreateInput.cs │ │ ├── CoreDumpUpdateInput.cs │ │ ├── FileDownloadInput.cs │ │ ├── FileListInput.cs │ │ ├── FleetCreateInput.cs │ │ ├── FleetIdInput.cs │ │ ├── FleetRegionCreateInput.cs │ │ ├── FleetRegionUpdateInput.cs │ │ ├── FleetUpdateInput.cs │ │ ├── MachineListInput.cs │ │ ├── ServerIdInput.cs │ │ └── ServerListInput.cs │ ├── Model │ │ ├── BuildConfigurationListItemOutput.cs │ │ ├── BuildConfigurationListOutput.cs │ │ ├── BuildConfigurationOutput.cs │ │ ├── BuildInstallsItemFailuresItemOutput.cs │ │ ├── BuildInstallsItemFailuresOutput.cs │ │ ├── BuildInstallsItemOutput.cs │ │ ├── BuildInstallsItemRegionsItemOutput.cs │ │ ├── BuildInstallsItemRegionsOutput.cs │ │ ├── BuildInstallsOutput.cs │ │ ├── BuildListOutput.cs │ │ ├── BuildOutput.cs │ │ ├── CcdOutput.cs │ │ ├── CoreDumpCredentialsOutput.cs │ │ ├── CoreDumpOutput.cs │ │ ├── FilesItemFleetOutput.cs │ │ ├── FilesItemMachineOutput.cs │ │ ├── FilesItemOutput.cs │ │ ├── FilesOutput.cs │ │ ├── FleetGetOutput.cs │ │ ├── FleetListItemOutput.cs │ │ ├── FleetListOutput.cs │ │ ├── FleetRegionCreateOutput.cs │ │ ├── FleetRegionUpdateOutput.cs │ │ ├── GcsCredentials.cs │ │ ├── InvalidGcsCredentialsFileFormat.cs │ │ ├── LocalFile.cs │ │ ├── MachinesItemOutput.cs │ │ ├── MachinesItemServerStatsOutput.cs │ │ ├── MachinesItemSpecOutput.cs │ │ ├── MachinesOutput.cs │ │ ├── RegionTemplateListItemOutput.cs │ │ ├── RegionTemplateListOutput.cs │ │ ├── ServerGetOutput.cs │ │ ├── ServersItemOutput.cs │ │ └── ServersOutput.cs │ ├── Service │ │ ├── GameServerHostingService.cs │ │ └── IGameServerHostingService.cs │ ├── Services │ │ ├── ApiClientFactory.cs │ │ ├── ApiExceptionConverter.cs │ │ ├── BuildClient.cs │ │ ├── BuildConfigsClient.cs │ │ ├── CcdCloudStorageClient.cs │ │ ├── CoreDumpStateConverter.cs │ │ ├── DeployFileService.cs │ │ ├── DummyBinaryBuilder.cs │ │ ├── FileReaderAdapter.cs │ │ ├── FleetClient.cs │ │ ├── GameServerHostingApiConfig.cs │ │ ├── GameServerHostingConfigLoader.cs │ │ ├── GcsCredentialParser.cs │ │ ├── IDeployFileService.cs │ │ ├── IGameServerHostingConfigLoader.cs │ │ └── ResourceNameTypeConverter.cs │ └── Unity.Services.Cli.GameServerHosting.csproj ├── Unity.Services.Cli.Integration.MockServer │ ├── Common │ │ ├── CommonKeys.cs │ │ └── IntegrationConfig.cs │ ├── IServiceApiMock.cs │ ├── MappingModelUtils.cs │ ├── MockApi.cs │ ├── ServiceMocks │ │ ├── AccessApiMock.cs │ │ ├── CloudCode │ │ │ ├── CloudCodeFetchMock.cs │ │ │ └── CloudCodeV1Mock.cs │ │ ├── CloudContentDeliveryApiMock.cs │ │ ├── CloudSaveApiMock.cs │ │ ├── EconomyApiMock.cs │ │ ├── GameServerHosting │ │ │ ├── GameServerHostingApiMock.cs │ │ │ └── Keys.cs │ │ ├── IdentityV1Mock.cs │ │ ├── LeaderboardApiMock.cs │ │ ├── LobbyApiMock.cs │ │ ├── PlayerApiMock.cs │ │ ├── RemoteConfig │ │ │ ├── Config.cs │ │ │ ├── ConfigValue.cs │ │ │ ├── GetResponse.cs │ │ │ ├── RemoteConfigMock.cs │ │ │ └── ValueType.cs │ │ └── TriggersApiMock.cs │ └── Unity.Services.Cli.Integration.MockServer.csproj ├── Unity.Services.Cli.Integration.MockServerApp │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ └── Unity.Services.Cli.Integration.MockServerApp.csproj ├── Unity.Services.Cli.IntegrationTest │ ├── AccessTests │ │ ├── AccessTests.cs │ │ └── Data │ │ │ ├── policy.json │ │ │ └── statements.json │ ├── AuthTests │ │ └── AuthTests.cs │ ├── Authoring │ │ ├── AuthoringTestCase.cs │ │ ├── Deploy │ │ │ ├── CloudCode │ │ │ │ └── CloudCodeDeployTests.cs │ │ │ ├── DeployPreconditionTests.cs │ │ │ ├── Economy │ │ │ │ └── EconomyDeployTests.cs │ │ │ ├── Leaderboards │ │ │ │ └── LeaderboardDeployTests.cs │ │ │ ├── ProjectAccess │ │ │ │ └── ProjectAccessDeployTests.cs │ │ │ ├── RemoteConfig │ │ │ │ ├── RemoteConfigDeployTests.cs │ │ │ │ └── RemoteConfigFileContent.cs │ │ │ └── Triggers │ │ │ │ └── TriggerDeployTests.cs │ │ ├── DeployTestsFixture.cs │ │ ├── Fetch │ │ │ ├── CloudCodeFetchTests.cs │ │ │ ├── EconomyFetchTests.cs │ │ │ ├── LeaderboardFetchTests.cs │ │ │ ├── ProjectAccessFetchTests.cs │ │ │ ├── RemoteConfigFetchTests.cs │ │ │ └── TriggersFetchTests.cs │ │ └── FetchTestsFixture.cs │ ├── CloudCodeTests │ │ ├── CloudCodeModuleTests.cs │ │ └── CloudCodeScriptTests.cs │ ├── CloudContentDeliveryTests │ │ ├── CloudContentDeliveryBadgeTests.cs │ │ ├── CloudContentDeliveryBucketTests.cs │ │ ├── CloudContentDeliveryEntryTests.cs │ │ └── CloudContentDeliveryReleaseTests.cs │ ├── CloudSaveTests │ │ └── CloudSaveTests.cs │ ├── Common │ │ ├── ProcessExtensions.cs │ │ ├── UgsCliBuilder.cs │ │ ├── UgsCliFixture.cs │ │ ├── UgsCliTestCase.ExternalProcess.cs │ │ ├── UgsCliTestCase.IProcess.cs │ │ ├── UgsCliTestCase.LocalProcess.cs │ │ └── UgsCliTestCase.cs │ ├── ConfigTests │ │ └── ConfigTests.cs │ ├── EconomyTests │ │ ├── EconomyPublishTests.cs │ │ ├── EconomyResourceTests.cs │ │ └── Resources │ │ │ ├── invalidCurrencyDefinition_BadValueType.ecc │ │ │ ├── invalidCurrencyDefinition_MissingField.ecc │ │ │ ├── invalidCurrencyDefinition_NegativeInitialAmount.ecc │ │ │ ├── invalidInventoryDefinition_MissingField.eci │ │ │ ├── invalidResourceDefinition_BadType.ecc │ │ │ ├── validCurrencyDefinition.ecc │ │ │ ├── validInventoryDefinition.eci │ │ │ ├── validRealMoneyPurchaseDefinition.ecr │ │ │ ├── validVirtualPurchaseDefinition.ecv │ │ │ └── validVirtualPurchaseDefinition_FreeGift.ecv │ ├── EnvTests │ │ └── EnvTests.cs │ ├── GameServerHostingTests │ │ ├── GameServerHostingBuildConfigurationCreateTests.cs │ │ ├── GameServerHostingBuildConfigurationDeleteTests.cs │ │ ├── GameServerHostingBuildConfigurationGetTests.cs │ │ ├── GameServerHostingBuildConfigurationListTests.cs │ │ ├── GameServerHostingBuildConfigurationUpdateTests.cs │ │ ├── GameServerHostingBuildCreateTests.cs │ │ ├── GameServerHostingBuildCreateVersionTests.cs │ │ ├── GameServerHostingBuildDeleteTests.cs │ │ ├── GameServerHostingBuildGetTests.cs │ │ ├── GameServerHostingBuildInstallsTests.cs │ │ ├── GameServerHostingBuildListTests.cs │ │ ├── GameServerHostingBuildUpdateTests.cs │ │ ├── GameServerHostingFleetRegionAvailableTests.cs │ │ ├── GameServerHostingFleetRegionCreateTests.cs │ │ ├── GameServerHostingFleetRegionTemplatesTests.cs │ │ ├── GameServerHostingFleetTests.cs │ │ ├── GameServerHostingMachineListTest.cs │ │ ├── GameServerHostingServerFileDownloadTests.cs │ │ ├── GameServerHostingServerFilesTests.cs │ │ ├── GameServerHostingServerGetTests.cs │ │ ├── GameServerHostingServerListTest.cs │ │ └── GameServerHostingTests.cs │ ├── LeaderboardTests │ │ ├── LeaderboardSetupFailureTests.cs │ │ └── LeaderboardTests.cs │ ├── LobbyTests │ │ └── LobbyTests.cs │ ├── MainTests │ │ └── HelpTests.cs │ ├── NewFile │ │ └── NewFileTests.cs │ ├── PlayerTests │ │ └── PlayerTests.cs │ └── Unity.Services.Cli.IntegrationTest.csproj ├── Unity.Services.Cli.Leaderboards.UnitTest │ ├── Deploy │ │ ├── LeaderboardClientTests.cs │ │ ├── LeaderboardDeploymentServiceTests.cs │ │ ├── LeaderboardFetchServiceTests.cs │ │ ├── LeaderboardPatchConverterTest.cs │ │ └── LeaderboardsConfigLoaderTests.cs │ ├── Handlers │ │ ├── DeleteLeaderboardHandlerTests.cs │ │ ├── GetLeaderboardConfigsHandlerTests.cs │ │ ├── GetLeaderboardHandlerTests.cs │ │ ├── ImportHandlerTests.cs │ │ ├── LeaderboardExportHandlerTests.cs │ │ └── ResetLeaderboardHandlerTests.cs │ ├── LeaderboardsModuleTests.cs │ ├── Mock │ │ └── LeaderboardApiV1AsyncMock.cs │ ├── Model │ │ ├── LeaderboardResponseOutputTest.cs │ │ └── LederboardConfigsResponseOutputTest.cs │ ├── Service │ │ └── LeaderboardsServiceTests.cs │ ├── Unity.Services.Cli.Leaderboards.UnitTest.csproj │ └── Utils │ │ └── TestValues.cs ├── Unity.Services.Cli.Leaderboards │ ├── Deploy │ │ ├── ILeaderboardsConfigLoader.cs │ │ ├── LeaderboardConfigFile.cs │ │ ├── LeaderboardPatchConverter.cs │ │ ├── LeaderboardsClient.cs │ │ ├── LeaderboardsConfigLoader.cs │ │ ├── LeaderboardsDeploymentService.cs │ │ ├── LeaderboardsFetchService.cs │ │ └── LeaderboardsSerializer.cs │ ├── Handlers │ │ ├── DeleteLeaderboardHandler.cs │ │ ├── GetLeaderboardConfigsHandler.cs │ │ ├── GetLeaderboardHandler.cs │ │ ├── ImportExport │ │ │ ├── ExportHandler.cs │ │ │ ├── ImportExportUtils.cs │ │ │ ├── ImportHandler.cs │ │ │ ├── LeaderboardsConstants.cs │ │ │ ├── LeaderboardsExporter.cs │ │ │ └── LeaderboardsImporter.cs │ │ ├── RequestBodyHandler.cs │ │ └── ResetLeaderboardHandler.cs │ ├── IO │ │ └── FileSystem.cs │ ├── Input │ │ ├── CreateInput.cs │ │ ├── LeaderboardIdInput.cs │ │ ├── ListLeaderboardInput.cs │ │ ├── ResetInput.cs │ │ └── UpdateInput.cs │ ├── LeaderboardsModule.cs │ ├── Model │ │ ├── GetLeaderboardConfigsResponseOutput.cs │ │ └── GetLeaderboardResponseOutput.cs │ ├── Service │ │ ├── ILeaderboardsService.cs │ │ └── LeaderboardsService.cs │ └── Unity.Services.Cli.Leaderboards.csproj ├── Unity.Services.Cli.Lobby.UnitTest │ ├── Handlers │ │ ├── BulkUpdateLobbyHandlerTests.cs │ │ ├── ConfigGetHandlerTests.cs │ │ ├── ConfigUpdateHandlerTests.cs │ │ ├── CreateLobbyHandlerTests.cs │ │ ├── DeleteLobbyHandlerTests.cs │ │ ├── ExportHandlerTests.cs │ │ ├── GetHostedLobbiesHandlerTests.cs │ │ ├── GetJoinedLobbiesHandlerTests.cs │ │ ├── GetLobbyHandlerTests.cs │ │ ├── HeartbeatHandlerTests.cs │ │ ├── ImportHandlerTests.cs │ │ ├── JoinLobbyHandlerTests.cs │ │ ├── LobbyConfigTests.cs │ │ ├── QueryLobbiesHandlerTests.cs │ │ ├── QuickJoinHandlerTests.cs │ │ ├── ReconnectHandlerTests.cs │ │ ├── RemovePlayerHandlerTests.cs │ │ ├── RequestBodyHandlerTests.cs │ │ ├── RequestTokenHandlerTests.cs │ │ ├── UpdateLobbyHandlerTests.cs │ │ └── UpdatePlayerHandlerTests.cs │ ├── LobbyModuleTests.cs │ ├── Mock │ │ └── LobbyApiV1AsyncMock.cs │ ├── Service │ │ └── LobbyServiceTests.cs │ └── Unity.Services.Cli.Lobby.UnitTest.csproj ├── Unity.Services.Cli.Lobby │ ├── Handlers │ │ ├── BulkUpdateLobbyHandler.cs │ │ ├── Config │ │ │ ├── ConfigSchema.cs │ │ │ ├── ConfigSchemaV2.cs │ │ │ ├── LobbyConfig.cs │ │ │ ├── lobby-config-schema-v2.json │ │ │ └── lobby-config-schema.json │ │ ├── ConfigGetHandler.cs │ │ ├── ConfigUpdateHandler.cs │ │ ├── CreateLobbyHandler.cs │ │ ├── DeleteLobbyHandler.cs │ │ ├── GetHostedLobbiesHandler.cs │ │ ├── GetJoinedLobbiesHandler.cs │ │ ├── GetLobbyHandler.cs │ │ ├── HeartbeatHandler.cs │ │ ├── ILobbyHandler.cs │ │ ├── ImportExport │ │ │ ├── ExportHandler.cs │ │ │ ├── ImportHandler.cs │ │ │ ├── LobbyExporter.cs │ │ │ └── LobbyImporter.cs │ │ ├── JoinLobbyHandler.cs │ │ ├── LobbyConstants.cs │ │ ├── QueryLobbiesHandler.cs │ │ ├── QuickJoinHandler.cs │ │ ├── ReconnectHandler.cs │ │ ├── RemovePlayerHandler.cs │ │ ├── RequestBodyHandler.cs │ │ ├── RequestTokenHandler.cs │ │ ├── UpdateLobbyHandler.cs │ │ └── UpdatePlayerHandler.cs │ ├── Inputs │ │ └── LobbyInput.cs │ ├── LobbyModule.cs │ ├── Service │ │ ├── ILobbyService.cs │ │ └── LobbyService.cs │ └── Unity.Services.Cli.Lobby.csproj ├── Unity.Services.Cli.Matchmaker.UnitTest │ ├── AdminApiClientUnitTests.cs │ ├── ConfigParserUnitTests.cs │ ├── DeploymentServiceUnitTests.cs │ ├── FetchServiceUnitTests.cs │ ├── MatchmakerModuleTest.cs │ ├── MatchmakerServiceUnitTests.cs │ ├── SampleConfigs │ │ ├── CoreSampleConfig.cs │ │ ├── GeneratedSampleConfig.cs │ │ ├── JsonSampleConfigLoader.cs │ │ ├── MultiplaySampleConfig.cs │ │ ├── TemplateQueueConfig.json │ │ ├── TestEmptyQueueConfig.json │ │ ├── TestEnvironmentConfig.json │ │ └── TestQueueConfig.json │ └── Unity.Services.Cli.Matchmaker.UnitTest.csproj ├── Unity.Services.Cli.Matchmaker │ ├── AdminApiClient │ │ ├── MatchmakerAdminClient.cs │ │ ├── ModelCoreToGenerated.cs │ │ └── ModelGeneratedToCore.cs │ ├── MatchmakerModule.cs │ ├── Parser │ │ ├── DataMemberEnumConverter.cs │ │ ├── HostingConfigTypeConverter.cs │ │ ├── JsonObjectSpecializedConverter.cs │ │ ├── MatchmakerConfigParser.cs │ │ └── ResourceNameConverter.cs │ ├── Service │ │ ├── AdminApiTargetEndpoint.cs │ │ ├── IMatchmakerService.cs │ │ ├── MatchmakerDeploymentService.cs │ │ ├── MatchmakerException.cs │ │ ├── MatchmakerFetchService.cs │ │ ├── MatchmakerService.cs │ │ └── QueueConfigTemplate.cs │ └── Unity.Services.Cli.Matchmaker.csproj ├── Unity.Services.Cli.Player.UnitTest │ ├── Handlers │ │ ├── CreateHandlerTests.cs │ │ ├── DeleteHandlerTests.cs │ │ ├── DisableHandlerTests.cs │ │ ├── EnableHandlerTests.cs │ │ ├── GetHandlerTests.cs │ │ └── ListHandlerTests.cs │ ├── PlayerModuleTests.cs │ ├── Service │ │ └── PlayerServiceTests.cs │ └── Unity.Services.Cli.Player.UnitTest.csproj ├── Unity.Services.Cli.Player │ ├── Handlers │ │ ├── CreateHandler.cs │ │ ├── DeleteHandler.cs │ │ ├── DisableHandler.cs │ │ ├── EnableHandler.cs │ │ ├── GetHandler.cs │ │ └── ListHandler.cs │ ├── Input │ │ └── PlayerInput.cs │ ├── Models │ │ └── PlayerListResponseResult.cs │ ├── Networking │ │ └── Endpoints │ │ │ ├── PlayerAdminEndpoints.cs │ │ │ └── PlayerAuthEndpoints.cs │ ├── PlayerModule.cs │ ├── Service │ │ ├── IPlayerService.cs │ │ └── PlayerService.cs │ └── Unity.Services.Cli.Player.csproj ├── Unity.Services.Cli.RemoteConfig.UnitTest │ ├── Deploy │ │ ├── CliRemoteConfigDeploymentHandlerTests.cs │ │ ├── ConfigTypeDeriverTests.cs │ │ ├── IllegalEntryDetectorTests.cs │ │ ├── JsonConverterTests.cs │ │ ├── RemoteConfigClientTests.cs │ │ ├── RemoteConfigDeploymentResultTests.cs │ │ ├── RemoteConfigDeploymentServiceTests.cs │ │ ├── RemoteConfigFetchServiceTests.cs │ │ ├── RemoteConfigScriptsLoaderTests.cs │ │ └── TestData.cs │ ├── ImportExport │ │ ├── ExportHandlerTests.cs │ │ └── ImportHandlerTests.cs │ ├── Model │ │ └── CliRemoteConfigEntryTests.cs │ ├── RemoteConfigModuleTests.cs │ ├── Service │ │ ├── RemoteConfigServiceTests.cs │ │ └── RemoteConfigServicesWrapperTests.cs │ └── Unity.Services.Cli.RemoteConfig.UnitTest.csproj ├── Unity.Services.Cli.RemoteConfig │ ├── Deploy │ │ ├── CliRemoteConfigDeploymentHandler.cs │ │ ├── CliRemoteConfigFetchHandler.cs │ │ ├── ConfigTypeDeriver.cs │ │ ├── FileSystem.cs │ │ ├── ICliRemoteConfigClient.cs │ │ ├── IRemoteConfigScriptsLoader.cs │ │ ├── IllegalEntryDetector.cs │ │ ├── JsonConverter.cs │ │ ├── LoadResult.cs │ │ ├── RemoteConfigClient.cs │ │ ├── RemoteConfigDeploymentResult.cs │ │ ├── RemoteConfigDeploymentService.cs │ │ ├── RemoteConfigFetchResult.cs │ │ ├── RemoteConfigFetchService.cs │ │ ├── RemoteConfigFile.cs │ │ └── RemoteConfigScriptsLoader.cs │ ├── Exceptions │ │ ├── ApiException.cs │ │ └── ConfigTypeException.cs │ ├── Handlers │ │ └── ExportImport │ │ │ ├── ExportHandler.cs │ │ │ ├── ImportHandler.cs │ │ │ ├── RemoteConfigConstants.cs │ │ │ ├── RemoteConfigExporter.cs │ │ │ └── RemoteConfigImporter.cs │ ├── Model │ │ ├── CliRemoteConfigEntry.cs │ │ ├── Config.cs │ │ ├── CreateResponse.cs │ │ ├── GetResponse.cs │ │ └── UpdateConfigRequest.cs │ ├── RemoteConfigModule.cs │ ├── Service │ │ ├── IRemoteConfigService.cs │ │ ├── IRemoteConfigServicesWrapper.cs │ │ ├── RemoteConfigService.cs │ │ └── RemoteConfigServicesWrapper.cs │ ├── Templates │ │ └── RemoteConfigTemplate.cs │ ├── Types │ │ └── Config.cs │ └── Unity.Services.Cli.RemoteConfig.csproj ├── Unity.Services.Cli.Scheduler.UnitTest │ ├── Deploy │ │ ├── ScheduleConfigLoaderTests.cs │ │ ├── SchedulerClientTests.cs │ │ ├── SchedulerDeploymentHandlerTests.cs │ │ ├── SchedulerDeploymentServiceTests.cs │ │ ├── SchedulerFetchHandlerTests.cs │ │ └── SchedulerFetchServiceTests.cs │ ├── Unity.Services.Cli.Scheduler.UnitTest.csproj │ ├── Usings.cs │ └── Utils │ │ └── TestValues.cs ├── Unity.Services.Cli.Scheduler │ ├── Deploy │ │ ├── IScheduleResourceLoader.cs │ │ ├── ScheduleConfigFile.cs │ │ ├── ScheduleDeploymentResult.cs │ │ ├── ScheduleFileItem.cs │ │ ├── ScheduleResourceLoader.cs │ │ ├── ScheduleSerializer.cs │ │ ├── SchedulerClient.cs │ │ ├── SchedulerDeployFetchBase.cs │ │ └── SchedulerDeploymentService.cs │ ├── Exceptions │ │ └── SchedulerException.cs │ ├── Fetch │ │ └── SchedulerFetchService.cs │ ├── Handlers │ │ └── SchedulerListHandler.cs │ ├── IO │ │ └── FileSystem.cs │ ├── SchedulerConstants.cs │ ├── SchedulerModule.cs │ └── Unity.Services.Cli.Scheduler.csproj ├── Unity.Services.Cli.ServiceAccountAuthentication.UnitTest │ ├── AuthenticationModuleTests.cs │ ├── Authenticator │ │ └── AuthenticatorV1Tests.cs │ ├── Handlers │ │ ├── LoginHandlerTests.cs │ │ ├── LogoutHandlerTests.cs │ │ └── StatusHandlerTests.cs │ ├── Mock │ │ └── MemoryTokenPersister.cs │ ├── Service │ │ └── AuthenticationServiceTests.cs │ ├── Token │ │ └── AccessTokenHelperTests.cs │ ├── Unity.Services.Cli.ServiceAccountAuthentication.UnitTest.csproj │ └── Utils │ │ └── ConsoleInputOverrideScope.cs ├── Unity.Services.Cli.ServiceAccountAuthentication │ ├── AuthenticationModule.cs │ ├── Authenticator │ │ ├── AuthenticatorV1.cs │ │ ├── IAuthenticator.cs │ │ └── Response │ │ │ └── LogoutResponse.cs │ ├── Exceptions │ │ ├── InvalidLoginInputException.cs │ │ └── MissingAccessTokenException.cs │ ├── Handlers │ │ ├── LoginHandler.cs │ │ ├── LogoutHandler.cs │ │ └── StatusHandler.cs │ ├── Input │ │ └── LoginInput.cs │ ├── Service │ │ ├── AuthenticationService.cs │ │ └── IServiceAccountAuthenticationService.cs │ ├── Token │ │ └── AccessTokenHelper.cs │ └── Unity.Services.Cli.ServiceAccountAuthentication.csproj ├── Unity.Services.Cli.TestUtils │ ├── MockHelper.cs │ ├── TestsHelper.cs │ └── Unity.Services.Cli.TestUtils.csproj ├── Unity.Services.Cli.Triggers.UnitTest │ ├── Deploy │ │ ├── TriggerClientTests.cs │ │ ├── TriggerDeploymentHandlerTests.cs │ │ ├── TriggerDeploymentServiceTests.cs │ │ ├── TriggerFetchHandlerTests.cs │ │ └── TriggerFetchServiceTests.cs │ ├── Service │ │ └── TriggersServiceTests.cs │ ├── Unity.Services.Cli.Triggers.UnitTest.csproj │ └── Utils │ │ └── TestValues.cs ├── Unity.Services.Cli.Triggers │ ├── Deploy │ │ ├── TriggerDeployFetchBase.cs │ │ ├── TriggersAuthoringResult.cs │ │ ├── TriggersClient.cs │ │ ├── TriggersConfigFile.cs │ │ ├── TriggersDeploymentService.cs │ │ ├── TriggersFileItem.cs │ │ └── TriggersSerializer.cs │ ├── Exceptions │ │ └── TriggersException.cs │ ├── Fetch │ │ └── TriggersFetchService.cs │ ├── IO │ │ ├── FileSystem.cs │ │ ├── ITriggersResourceLoader.cs │ │ └── TriggersResourceLoader.cs │ ├── Service │ │ ├── ITriggersService.cs │ │ └── TriggersService.cs │ ├── TriggersConstants.cs │ ├── TriggersModule.cs │ └── Unity.Services.Cli.Triggers.csproj ├── Unity.Services.Cli.sln ├── Unity.Services.Cli.sln.DotSettings ├── Unity.Services.Cli │ ├── Program.LoggerConsole.cs │ ├── Program.cs │ ├── Properties │ │ └── launchSettings.json │ ├── Unity.Services.Cli.csproj │ └── appsettings.json ├── Unity.Services.CloudContentDelivery.Authoring.Core │ ├── Deploy │ │ ├── CloudContentDeliveryDeploymentHandler.cs │ │ ├── DeployResult.cs │ │ └── ICloudContentDeliveryDeploymentHandler.cs │ ├── Fetch │ │ ├── CloudContentDeliveryFetchHandler.cs │ │ ├── FetchResult.cs │ │ └── ICloudContentDeliveryFetchHandler.cs │ ├── IO │ │ └── IFileSystem.cs │ ├── Model │ │ ├── IBucket.cs │ │ └── Statuses.cs │ ├── Service │ │ └── ICloudContentDeliveryClient.cs │ ├── Unity.Services.CloudContentDelivery.Authoring.Core.csproj │ └── Validations │ │ └── DuplicateResourceValidation.cs ├── Unity.Services.CloudSave.Authoring.Core │ ├── Batching │ │ └── Batching.cs │ ├── Deploy │ │ ├── CloudSaveDeploymentHandler.cs │ │ ├── CloudSaveFetchDeployBase.cs │ │ ├── DeployResult.cs │ │ └── ICloudSaveDeploymentHandler.cs │ ├── Fetch │ │ ├── CloudSaveFetchHandler.cs │ │ ├── FetchResult.cs │ │ └── ICloudSaveFetchHandler.cs │ ├── IO │ │ ├── ICloudSaveSimpleResourceLoader.cs │ │ └── IFileSystem.cs │ ├── Model │ │ ├── ClientException.cs │ │ ├── Constants.cs │ │ ├── IResource.cs │ │ ├── SimpleResource.cs │ │ ├── SimpleResourceItem.cs │ │ └── Statuses.cs │ ├── Service │ │ └── ICloudSaveClient.cs │ ├── Unity.Services.CloudSave.Authoring.Core.csproj │ └── Validations │ │ └── DuplicateResourceValidation.cs ├── Unity.Services.ModuleTemplate.Authoring.Core │ ├── .template.config │ │ └── template.json │ ├── Batching │ │ └── Batching.cs │ ├── Deploy │ │ ├── CompoundModuleTemplateDeploymentHandler.cs │ │ ├── DeployResult.cs │ │ ├── ICompoundModuleTemplateDeploymentHandler.cs │ │ ├── IModuleTemplateDeploymentHandler.cs │ │ ├── ModuleTemplateDeploymentHandler.cs │ │ └── ModuleTemplateFetchDeployBase.cs │ ├── Fetch │ │ ├── CompoundModuleTemplateFetchHandler.cs │ │ ├── FetchResult.cs │ │ ├── ICompoundModuleTemplateFetchHandler.cs │ │ ├── IModuleTemplateFetchHandler.cs │ │ └── ModuleTemplateFetchHandler.cs │ ├── IO │ │ ├── CompoundResourceConfigFile.cs │ │ ├── IFileSystem.cs │ │ ├── IModuleTemplateCompoundResourceLoader.cs │ │ └── IModuleTemplateSimpleResourceLoader.cs │ ├── Model │ │ ├── ClientException.cs │ │ ├── Constants.cs │ │ ├── ICompoundResourceDeploymentItem.cs │ │ ├── IResource.cs │ │ ├── SimpleResource.cs │ │ ├── SimpleResourceDeploymentItem.cs │ │ └── Statuses.cs │ ├── Service │ │ └── IModuleTemplateClient.cs │ ├── Unity.Services.ModuleTemplate.Authoring.Core.csproj │ └── Validations │ │ └── DuplicateResourceValidation.cs ├── Unity.Services.Scheduler.Authoring.Core │ ├── Batching │ │ └── Batching.cs │ ├── Deploy │ │ ├── DeployResult.cs │ │ ├── IScheduleDeploymentHandler.cs │ │ └── SchedulerDeploymentHandler.cs │ ├── Fetch │ │ ├── FetchResult.cs │ │ ├── IScheduleFetchHandler.cs │ │ └── SchedulerFetchHandler.cs │ ├── IO │ │ └── IFileSystem.cs │ ├── Model │ │ ├── IScheduleConfig.cs │ │ ├── ScheduleComparer.cs │ │ ├── ScheduleConfig.cs │ │ └── Statuses.cs │ ├── Serialization │ │ └── ISchedulesSerializer.cs │ ├── Service │ │ └── ISchedulerClient.cs │ ├── Unity.Services.Scheduler.Authoring.Core.csproj │ └── Validations │ │ └── DuplicateResourceValidation.cs ├── Unity.Services.Triggers.Authoring.Core │ ├── Batching │ │ └── Batching.cs │ ├── Deploy │ │ ├── DeployResult.cs │ │ ├── ITriggersDeploymentHandler.cs │ │ └── TriggersDeploymentHandler.cs │ ├── Fetch │ │ ├── FetchResult.cs │ │ ├── ITriggersFetchHandler.cs │ │ └── TriggersFetchHandler.cs │ ├── IO │ │ └── IFileSystem.cs │ ├── Model │ │ ├── ITriggerConfig.cs │ │ ├── Statuses.cs │ │ ├── TriggerComparer.cs │ │ └── TriggerConfig.cs │ ├── Serialization │ │ └── ITriggersSerializer.cs │ ├── Service │ │ └── ITriggersClient.cs │ ├── Unity.Services.Triggers.Authoring.Core.csproj │ └── Validations │ │ └── DuplicateResourceValidation.cs └── nuget.config ├── build.py ├── installer.sh └── test.runsettings /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | false 4 | 5 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/runtime-deps:7.0.4-alpine3.16-amd64 2 | 3 | ARG UGS_VERSION=latest 4 | 5 | RUN apk add --no-cache curl ncurses 6 | 7 | # Set the URL based on the version 8 | RUN if [ "$UGS_VERSION" = "latest" ]; then \ 9 | UGS_URL="https://github.com/Unity-Technologies/unity-gaming-services-cli/releases/latest/download/ugs-linux-musl-x64"; \ 10 | else \ 11 | UGS_URL="https://github.com/Unity-Technologies/unity-gaming-services-cli/releases/download/$UGS_VERSION/ugs-linux-musl-x64"; \ 12 | fi \ 13 | && echo "Installing UGS cli version \"$UGS_VERSION\" from \"$UGS_URL\"" \ 14 | && curl -f -L "$UGS_URL" -o /bin/ugs 15 | 16 | RUN chmod +x /bin/ugs 17 | 18 | # Add some color to it 19 | ENV TERM=xterm-256color 20 | -------------------------------------------------------------------------------- /License.md: -------------------------------------------------------------------------------- 1 | Unity Gaming Services Command-line Interface (UGS CLI) copyright © 2022 Unity Technologies. 2 | 3 | This software is subject to, and made available under, the Unity Terms of Service (see https://unity.com/legal). Your use of this software constitutes your acceptance of such terms. 4 | 5 | Unless expressly provided otherwise, the software under this license is made available strictly on an "AS IS" BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the terms of service for details on these and other terms and conditions. 6 | -------------------------------------------------------------------------------- /Samples/Deploy/Access/sample-policy.ac: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ugs-config-schemas.unity3d.com/v1/project-access-policy.schema.json", 3 | "Statements": [ 4 | { 5 | "Sid": "DenyAccessToAllServices", 6 | "Action": [ 7 | "*" 8 | ], 9 | "Effect": "Allow", 10 | "Principal": "Player", 11 | "Resource": "urn:ugs:*", 12 | "Version": "1.0.0" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /Samples/Deploy/CloudCode/Module/Module.ccm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/unity-gaming-services-cli/5b4c22de2dc6b36db0d22c695b4240bfae67d1a7/Samples/Deploy/CloudCode/Module/Module.ccm -------------------------------------------------------------------------------- /Samples/Deploy/Economy/CURRENCY.ecc: -------------------------------------------------------------------------------- 1 | { 2 | "initial": 3333, 3 | "name": "currency" 4 | } 5 | -------------------------------------------------------------------------------- /Samples/Deploy/Economy/INVENTORY_ITEM.eci: -------------------------------------------------------------------------------- 1 | { 2 | "name": "inventory item" 3 | } 4 | -------------------------------------------------------------------------------- /Samples/Deploy/Economy/REAL_MONEY_PURCHASE.ecr: -------------------------------------------------------------------------------- 1 | { 2 | "storeIdentifiers": { 3 | "googlePlayStore": "123" 4 | }, 5 | "rewards": [ 6 | { 7 | "resourceId": "CURRENCY", 8 | "amount": 6 9 | } 10 | ], 11 | "name": "My Real Money Purchase" 12 | } 13 | -------------------------------------------------------------------------------- /Samples/Deploy/Economy/VIRTUAL_MONEY_PURCHASE.ecv: -------------------------------------------------------------------------------- 1 | { 2 | "costs": [ 3 | { 4 | "resourceId": "CURRENCY", 5 | "amount": 2 6 | } 7 | ], 8 | "rewards": [ 9 | { 10 | "resourceId": "INVENTORY_ITEM", 11 | "amount": 6 12 | } 13 | ], 14 | "name": "My Virtual Purchase" 15 | } 16 | -------------------------------------------------------------------------------- /Samples/Deploy/Leaderboards/lbsample.lb: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ugs-config-schemas.unity3d.com/v1/leaderboards.schema.json", 3 | "SortOrder": "asc", 4 | "UpdateType": "keepBest", 5 | "Name": "My Leaderboard", 6 | "ResetConfig": { 7 | "Start": "2033-08-25T00:00:00-04:00", 8 | "Schedule": "0 12 1 * *" 9 | }, 10 | "TieringConfig": { 11 | "Strategy": "score", 12 | "Tiers": [ 13 | { 14 | "Id": "Gold", 15 | "Cutoff": 200.0 16 | }, 17 | { 18 | "Id": "Silver", 19 | "Cutoff": 100.0 20 | }, 21 | { 22 | "Id": "Bronze" 23 | } 24 | ] 25 | } 26 | } -------------------------------------------------------------------------------- /Samples/Deploy/Matchmaker/environment-config.mme: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ugs-config-schemas.unity3d.com/v1/matchmaker/matchmaker-environment-config.schema.json", 3 | "enabled": true, 4 | "defaultQueueName": "default-queue" 5 | } 6 | -------------------------------------------------------------------------------- /Samples/Deploy/RemoteConfig/configuration.rc: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ugs-config-schemas.unity3d.com/v1/remote-config.schema.json", 3 | "entries": { 4 | "string_key": "string_value", 5 | "int_key": 1, 6 | "bool_key": true, 7 | "long_key": 10000, 8 | "float_key": 1, 9 | "json_key": { 10 | "sample_key": "sample_value" 11 | } 12 | }, 13 | 14 | "types" : { 15 | "long_key": "LONG", 16 | "float_key": "FLOAT" 17 | } 18 | } -------------------------------------------------------------------------------- /Samples/Deploy/Triggers/my-triggers.tr: -------------------------------------------------------------------------------- 1 | { 2 | "Configs": [ 3 | { 4 | "Name": "Trigger 1", 5 | "EventType": "EventType1", 6 | "ActionType": "cloud-code", 7 | "ActionUrn": "urn:ugs:cloud-code:MyScript" 8 | }, 9 | { 10 | "Name": "Trigger 2", 11 | "EventType": "EventType2", 12 | "ActionType": "cloud-code", 13 | "ActionUrn": "urn:ugs:cloud-code:MyModule/MyFunction" 14 | }, 15 | { 16 | "Name": "Trigger 3", 17 | "EventType": "EventType3", 18 | "ActionType": "cloud-code", 19 | "ActionUrn": "urn:ugs:cloud-code:MyModule/MyFunction", 20 | "Filter": "data['leaderboardId] == 'some-leaderboard-id'" 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Access/Deploy/IAccessConfigLoader.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Access.Deploy; 2 | 3 | interface IAccessConfigLoader 4 | { 5 | Task LoadFilesAsync( 6 | IReadOnlyList filePaths, 7 | CancellationToken token); 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Access/Deploy/LoadResult.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Tooling.Editor.AccessControl.Authoring.Core.Model; 2 | 3 | namespace Unity.Services.Cli.Access.Deploy; 4 | 5 | class LoadResult 6 | { 7 | public IReadOnlyList Loaded { get; } 8 | public IReadOnlyList Failed { get; } 9 | 10 | public LoadResult(IReadOnlyList loaded, IReadOnlyList failed) 11 | { 12 | Loaded = loaded; 13 | Failed = failed; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Access/IO/FileSystem.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Tooling.Editor.AccessControl.Authoring.Core.IO; 2 | 3 | namespace Unity.Services.Cli.Access.IO; 4 | 5 | public class FileSystem : IFileSystem 6 | { 7 | public Task ReadAllText(string path, CancellationToken token = default(CancellationToken)) 8 | { 9 | return File.ReadAllTextAsync(path, token); 10 | } 11 | 12 | public Task WriteAllText(string path, string contents, CancellationToken token = default(CancellationToken)) 13 | { 14 | return File.WriteAllTextAsync(path, contents, token); 15 | } 16 | 17 | public Task Delete(string path, CancellationToken token = default(CancellationToken)) 18 | { 19 | File.Delete(path); 20 | return Task.CompletedTask; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Access/Input/AccessInput.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.Common.Input; 3 | 4 | namespace Unity.Services.Cli.Access.Input; 5 | 6 | public class AccessInput : CommonInput 7 | { 8 | public static readonly Argument PlayerIdArgument = new( 9 | name: "player-id", description: "The ID of the player"); 10 | 11 | public static readonly Argument FilePathArgument = new( 12 | name: "file-path", description: "The path of the JSON file"); 13 | 14 | [InputBinding(nameof(PlayerIdArgument))] 15 | public string? PlayerId { get; set; } 16 | 17 | [InputBinding(nameof(FilePathArgument))] 18 | public FileInfo? FilePath { get; set; } 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Access/Models/GetAllPlayerPoliciesResponseOutput.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Unity.Services.Gateway.AccessApiV1.Generated.Model; 3 | 4 | namespace Unity.Services.Cli.Access.Models; 5 | 6 | class GetAllPlayerPoliciesResponseOutput 7 | { 8 | public List Results { get; } 9 | 10 | public GetAllPlayerPoliciesResponseOutput(List results) 11 | { 12 | Results = results; 13 | } 14 | 15 | public override string ToString() 16 | { 17 | return JsonConvert.SerializeObject(this.Results, Formatting.Indented); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Access/Models/GetPlayerPolicyResponseOutput.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Unity.Services.Gateway.AccessApiV1.Generated.Model; 3 | 4 | namespace Unity.Services.Cli.Access.Models; 5 | 6 | class GetPlayerPolicyResponseOutput 7 | { 8 | public PlayerPolicy Policy { get; } 9 | 10 | public GetPlayerPolicyResponseOutput(PlayerPolicy policy) 11 | { 12 | Policy = policy; 13 | } 14 | 15 | public override string ToString() 16 | { 17 | return JsonConvert.SerializeObject(this.Policy, Formatting.Indented); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Access/Models/GetPolicyResponseOutput.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Unity.Services.Gateway.AccessApiV1.Generated.Model; 3 | 4 | namespace Unity.Services.Cli.Access.Models; 5 | 6 | class GetPolicyResponseOutput 7 | { 8 | public Policy Policy { get; } 9 | 10 | public GetPolicyResponseOutput(Policy policy) 11 | { 12 | Policy = policy; 13 | } 14 | 15 | public override string ToString() 16 | { 17 | return JsonConvert.SerializeObject(this.Policy, Formatting.Indented); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Access/Service/AccessEndpoints.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Common.Networking; 2 | 3 | namespace Unity.Services.Cli.Access.Service; 4 | 5 | public class AccessEndpoints : NetworkTargetEndpoints 6 | { 7 | protected override string Prod { get; } = "https://services.api.unity.com"; 8 | 9 | protected override string Staging { get; } = "https://staging.services.api.unity.com"; 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/Compression/ZipEntryStream.cs: -------------------------------------------------------------------------------- 1 | using System.IO.Compression; 2 | 3 | namespace Unity.Services.Cli.Authoring.Compression; 4 | 5 | public class ZipEntryStream : IDisposable 6 | { 7 | readonly ZipArchive? m_Archive; 8 | public Stream Stream { get; } 9 | 10 | public ZipEntryStream(Stream stream, ZipArchive? archive = null) 11 | { 12 | m_Archive = archive; 13 | Stream = stream; 14 | } 15 | 16 | public void Dispose() 17 | { 18 | m_Archive?.Dispose(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/DeploymentDefinition/CliDeploymentDefinition.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.ObjectModel; 2 | using Unity.Services.Deployment.Core.Model; 3 | using IoPath = System.IO.Path; 4 | 5 | namespace Unity.Services.Cli.Authoring.Model; 6 | 7 | class CliDeploymentDefinition : IDeploymentDefinition 8 | { 9 | 10 | public string Name { get; set; } 11 | 12 | public string Path { get; set; } 13 | 14 | public ObservableCollection ExcludePaths { get; } 15 | 16 | public CliDeploymentDefinition(string path) 17 | { 18 | Path = path; 19 | Name = ""; 20 | ExcludePaths = new ObservableCollection(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/DeploymentDefinition/DeploymentDefinitionInputResult.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Deployment.Core.Model; 2 | 3 | namespace Unity.Services.Cli.Authoring.Service; 4 | 5 | class DeploymentDefinitionInputResult 6 | { 7 | public IReadOnlyList InputDeploymentDefinitions { get; } 8 | public IReadOnlyList AllDeploymentDefinitions { get; } 9 | 10 | public DeploymentDefinitionInputResult( 11 | IReadOnlyList inputDeploymentDefinitions, 12 | IReadOnlyList allDeploymentDefinitions) 13 | { 14 | InputDeploymentDefinitions = inputDeploymentDefinitions; 15 | AllDeploymentDefinitions = allDeploymentDefinitions; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/DeploymentDefinition/ICliDeploymentDefinitionService.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Authoring.DeploymentDefinition; 2 | using Unity.Services.Deployment.Core; 3 | 4 | namespace Unity.Services.Cli.Authoring.Service; 5 | 6 | interface ICliDeploymentDefinitionService : IDeploymentDefinitionService 7 | { 8 | IDeploymentDefinitionFilteringResult GetFilesFromInput( 9 | IEnumerable inputPaths, 10 | IEnumerable extensions); 11 | } 12 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/DeploymentDefinition/IDeploymentDefinitionFactory.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Deployment.Core.Model; 2 | 3 | namespace Unity.Services.Cli.Authoring.DeploymentDefinition; 4 | 5 | interface IDeploymentDefinitionFactory 6 | { 7 | IDeploymentDefinition CreateDeploymentDefinition(string path); 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/DeploymentDefinition/IDeploymentDefinitionFileService.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Deployment.Core.Model; 2 | 3 | namespace Unity.Services.Cli.Authoring.Service; 4 | 5 | interface IDeploymentDefinitionFileService : IDeployFileService 6 | { 7 | DeploymentDefinitionInputResult GetDeploymentDefinitionsForInput(IEnumerable inputPaths); 8 | IReadOnlyList GetFilesForDeploymentDefinition( 9 | IDeploymentDefinition deploymentDefinition, 10 | string extension); 11 | } 12 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/DeploymentDefinition/IDeploymentDefinitionFiles.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Deployment.Core.Model; 2 | 3 | namespace Unity.Services.Cli.Authoring.DeploymentDefinition; 4 | 5 | interface IDeploymentDefinitionFiles 6 | { 7 | public IReadOnlyDictionary> FilesByExtension { get; } 8 | public IReadOnlyDictionary> FilesByDeploymentDefinition { get; } 9 | public IReadOnlyDictionary> ExcludedFilesByDeploymentDefinition { get; } 10 | public bool HasExcludes { get; } 11 | } 12 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/DeploymentDefinition/IDeploymentDefinitionFilteringResult.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Authoring.DeploymentDefinition; 2 | 3 | interface IDeploymentDefinitionFilteringResult 4 | { 5 | public IDeploymentDefinitionFiles DefinitionFiles { get; } 6 | public Dictionary> AllFilesByExtension { get; } 7 | public string GetExclusionsLogMessage(); 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/DeploymentDefinition/MultipleDeploymentDefinitionInDirectoryException.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Deployment.Core.Model; 2 | 3 | namespace Unity.Services.Cli.Authoring.DeploymentDefinition; 4 | 5 | public class MultipleDeploymentDefinitionInDirectoryException : Exception 6 | { 7 | internal MultipleDeploymentDefinitionInDirectoryException( 8 | IDeploymentDefinition ddef1, 9 | IDeploymentDefinition ddef2, 10 | string path) 11 | : base($"Multiple deployment definitions were found in the directory '{path}': '{ddef1.Name}.ddef' and '{ddef2.Name}.ddef'") 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/Exceptions/InvalidExtensionException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace Unity.Services.Cli.Authoring.Exceptions; 4 | 5 | /// 6 | /// Exception when a user specified deploy path does not have expected extension 7 | /// 8 | public class InvalidExtensionException: DeployException 9 | { 10 | public InvalidExtensionException(string path, string extension) 11 | : base($"File path must end in '{extension}': {path}") { } 12 | } 13 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/Exceptions/PathNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace Unity.Services.Cli.Authoring.Exceptions; 4 | 5 | /// 6 | /// Exception when a user specified deploy path is not found 7 | /// 8 | public class PathNotFoundException: DeployException 9 | { 10 | public PathNotFoundException(string path) 11 | : base($"Path {path} could not be found.") { } 12 | } 13 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/Export/ExportState.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Authoring.Model; 2 | 3 | namespace Unity.Services.Cli.Authoring.Export; 4 | 5 | public record ExportState(IReadOnlyCollection> ToExport) 6 | { 7 | internal IEnumerable ExportedItems() => ToExport.Select(e => e.ToImportExportItem(ImportExportAction.Export)); 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/Export/IExporter.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Authoring.Export.Input; 2 | 3 | namespace Unity.Services.Cli.Authoring.Export; 4 | 5 | public interface IExporter 6 | { 7 | Task ExportAsync(ExportInput input, CancellationToken cancellationToken); 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/Import/IImporter.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Authoring.Import.Input; 2 | 3 | namespace Unity.Services.Cli.Authoring.Import; 4 | 5 | public interface IImporter 6 | { 7 | Task ImportAsync(ImportInput input, CancellationToken cancellationToken, int maxParallelTaskLimit = 10); 8 | } -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/Input/DeployInput.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.Common.Input; 3 | 4 | namespace Unity.Services.Cli.Authoring.Input; 5 | 6 | /// 7 | /// Deploy command input 8 | /// 9 | public class DeployInput : AuthoringInput 10 | { 11 | public static readonly Argument> PathsArgument = new( 12 | "paths", 13 | "The paths to deploy from. Accepts multiple directory or file paths. Specify '.' to deploy in current directory"); 14 | 15 | [InputBinding(nameof(PathsArgument))] 16 | public IReadOnlyList Paths { get; set; } = new List(); 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/Input/DryRunInput.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.Common.Input; 3 | 4 | namespace Unity.Services.Cli.Authoring.Input; 5 | 6 | /// 7 | /// Class defining inputs for dry run. 8 | /// 9 | public class DryRunInput : CommonInput 10 | { 11 | static DryRunInput() 12 | { 13 | DryRunOption.SetDefaultValue(false); 14 | } 15 | 16 | /* Option for dry run */ 17 | public static readonly Option DryRunOption = new("--dry-run", "The command will do a dry run") 18 | { 19 | Arity = ArgumentArity.Zero 20 | }; 21 | 22 | [InputBinding(nameof(DryRunOption))] 23 | public bool DryRun { get; set; } 24 | } 25 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/Input/FetchInput.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.Common.Input; 3 | 4 | namespace Unity.Services.Cli.Authoring.Input; 5 | 6 | /// 7 | /// Fetch command input 8 | /// 9 | public class FetchInput : AuthoringInput 10 | { 11 | public static readonly Argument PathArgument = new( 12 | "path", 13 | $"The path to fetch to. Accepts a directory path to fetch to. Specify '.' to fetch in current directory"); 14 | 15 | [InputBinding(nameof(PathArgument))] 16 | public string Path { get; set; } = string.Empty; 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/Input/NewFileInput.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.Common.Input; 3 | 4 | namespace Unity.Services.Cli.Authoring.Input; 5 | 6 | public class NewFileInput : CommonInput 7 | { 8 | public static readonly Argument FileArgument = new( 9 | "file name", 10 | () => null!, 11 | "The name of the file to create"); 12 | 13 | [InputBinding(nameof(FileArgument))] 14 | public string? File { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/Model/AuthoringResultServiceTask.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Authoring.Model; 2 | 3 | public class AuthoringResultServiceTask 4 | where T : AuthorResult 5 | { 6 | public Task AuthorResultTask { get; } 7 | public string ServiceType { get; } 8 | 9 | public AuthoringResultServiceTask(Task authorResultTask, string serviceType) 10 | { 11 | AuthorResultTask = authorResultTask; 12 | ServiceType = serviceType; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/Model/Statuses.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.DeploymentApi.Editor; 2 | 3 | namespace Unity.Services.Cli.Authoring.Model; 4 | 5 | public static class Statuses 6 | { 7 | public const string FailedToRead = "Failed To Read"; 8 | public const string Created = "Created"; 9 | public const string Updated = "Updated"; 10 | public const string Deleted = "Deleted"; 11 | public const string Loading = "Loading"; 12 | public const string Loaded = "Loaded"; 13 | public const string Deployed = "Deployed"; 14 | public const string Fetched = "Fetched"; 15 | public static DeploymentStatus GetFailedToFetch(string messageDetail) => new DeploymentStatus("Failed to fetch", messageDetail, SeverityLevel.Error); 16 | } 17 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/Service/IAuthoringService.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Authoring.Service; 2 | 3 | public interface IAuthoringService 4 | { 5 | string ServiceType { get; } 6 | string ServiceName { get; } 7 | IReadOnlyList FileExtensions { get; } 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/Service/ICliDeploymentOutputHandler.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Authoring.Model; 2 | 3 | namespace Unity.Services.Cli.Authoring.Service; 4 | 5 | /// 6 | /// Interface to handle deployment output 7 | /// 8 | public interface ICliDeploymentOutputHandler 9 | { 10 | /// 11 | /// Collection of contents to be deployed 12 | /// 13 | ICollection Contents { get; } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/Service/IDeployFileService.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Authoring.Service; 2 | 3 | public interface IDeployFileService 4 | { 5 | /// 6 | /// List Files from paths with expected extension 7 | /// 8 | /// list of file or directory paths to evaluate 9 | /// target file extension. For example ".js" to look for java script file 10 | /// if the path is a directory, should it be scanned 11 | /// paths of files with target file extension 12 | IReadOnlyList ListFilesToDeploy(IReadOnlyList paths, string extension, bool ignoreDirectory); 13 | } 14 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/Service/IDeploymentService.cs: -------------------------------------------------------------------------------- 1 | using Spectre.Console; 2 | using Unity.Services.Cli.Authoring.Input; 3 | using Unity.Services.Cli.Authoring.Model; 4 | 5 | namespace Unity.Services.Cli.Authoring.Service; 6 | 7 | public interface IDeploymentService : IAuthoringService 8 | { 9 | Task Deploy( 10 | DeployInput deployInput, 11 | IReadOnlyList filePaths, 12 | string projectId, 13 | string environmentId, 14 | StatusContext? loadingContext, 15 | CancellationToken cancellationToken); 16 | } 17 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/Service/IFetchService.cs: -------------------------------------------------------------------------------- 1 | using Spectre.Console; 2 | using Unity.Services.Cli.Authoring.Input; 3 | using Unity.Services.Cli.Authoring.Model; 4 | 5 | namespace Unity.Services.Cli.Authoring.Service; 6 | 7 | public interface IFetchService : IAuthoringService 8 | { 9 | Task FetchAsync( 10 | FetchInput input, 11 | IReadOnlyList filePaths, 12 | string projectId, 13 | string environmentId, 14 | StatusContext? loadingContext, 15 | CancellationToken cancellationToken); 16 | } 17 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Authoring/Templates/IFileTemplate.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Authoring.Templates; 2 | 3 | /// 4 | /// Interface to provide template for new file command 5 | /// 6 | public interface IFileTemplate 7 | { 8 | /// 9 | /// File extension 10 | /// 11 | string Extension { get; } 12 | 13 | /// 14 | /// File body content 15 | /// 16 | string FileBodyText { get; } 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/IO/AssemblyLoaderTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using Unity.Services.Cli.CloudCode.IO; 3 | using Unity.Services.Cli.CloudCode.Solution; 4 | 5 | namespace Unity.Services.Cli.CloudCode.UnitTest.IO; 6 | 7 | class AssemblyLoaderTests 8 | { 9 | AssemblyLoader m_AssemblyLoader; 10 | 11 | public AssemblyLoaderTests() 12 | { 13 | m_AssemblyLoader = new AssemblyLoader(); 14 | } 15 | 16 | [Test] 17 | public void LoadsCorrectAssembly() 18 | { 19 | var assembly = m_AssemblyLoader.Load(FileContentRetriever.AssemblyString); 20 | Assert.IsTrue(assembly.FullName?.StartsWith(FileContentRetriever.AssemblyString)); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ModuleTestCases/Module.ccm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/unity-gaming-services-cli/5b4c22de2dc6b36db0d22c695b4240bfae67d1a7/Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ModuleTestCases/Module.ccm -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ModuleTestCases/test.ccmzip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/unity-gaming-services-cli/5b4c22de2dc6b36db0d22c695b4240bfae67d1a7/Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ModuleTestCases/test.ccmzip -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/Import/test.jszip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/unity-gaming-services-cli/5b4c22de2dc6b36db0d22c695b4240bfae67d1a7/Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/Import/test.jszip -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/AsyncOperation.js: -------------------------------------------------------------------------------- 1 | function sleep(ms) { 2 | return new Promise(resolve => setTimeout(resolve, ms)); 3 | } 4 | 5 | async function demo() { 6 | await sleep(2000); 7 | } 8 | 9 | demo(); 10 | 11 | module.exports.params = { 12 | asyncOp: "NUMERIC" 13 | }; 14 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/AsyncOperation.json: -------------------------------------------------------------------------------- 1 | { "asyncOp": "NUMERIC" } -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/BigInt.js: -------------------------------------------------------------------------------- 1 | module.exports.params = { 2 | sides: BigInt("9007199254740991") 3 | }; 4 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/CyclicReference.js: -------------------------------------------------------------------------------- 1 | var me = { 2 | name:"Kris", 3 | father:{name:"Bill"}, 4 | }; 5 | 6 | me.father.father = me; 7 | 8 | module.exports.params = me; 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/HugeFile.json: -------------------------------------------------------------------------------- 1 | { "huge": "NUMERIC" } -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/InfiniteLoop.js: -------------------------------------------------------------------------------- 1 | while(true) 2 | { 3 | } 4 | module.exports.params = { 5 | data: "NUMBER" 6 | } 7 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/MemoryAllocation.js: -------------------------------------------------------------------------------- 1 | const test = (array) => { 2 | array.push((new Array(1000000)).fill("test")); 3 | }; 4 | 5 | const testArray = []; 6 | 7 | for(let i = 0; i <= 1000; i++) { 8 | test(testArray); 9 | } 10 | 11 | module.exports.params = { 12 | data: testArray 13 | } 14 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/MixedValue.js: -------------------------------------------------------------------------------- 1 | module.exports.params = { 2 | bleu: { 3 | type: "STRING", 4 | required: true 5 | }, 6 | noir: "ANY", 7 | rouge: { 8 | type: "JSON" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/MixedValueParam.json: -------------------------------------------------------------------------------- 1 | { "bleu": { "type": "STRING", "required": true }, "noir": "ANY", "rouge": { "type": "JSON" } } -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/ParamInvalidRequired.json: -------------------------------------------------------------------------------- 1 | { 2 | "bleu": { 3 | "type": "STRING", 4 | "required": "Yes" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/ParamInvalidType.json: -------------------------------------------------------------------------------- 1 | { 2 | "sides": "NUMERI" 3 | } 4 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/QuotedString.js: -------------------------------------------------------------------------------- 1 | module.exports.params = { 2 | type: "STRING", 3 | text: "\"SampleText\"" 4 | } 5 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/QuotedString.json: -------------------------------------------------------------------------------- 1 | { "type": "STRING", "text": "\"SampleText\"" } -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/ReadFile.js: -------------------------------------------------------------------------------- 1 | var fs = require("fs"); 2 | 3 | const text = "Number" 4 | fs.writeFileSync('FileShouldNotExist.txt', text); 5 | const data = fs.readFileSync('FileShouldNotExist.txt', {encoding:'utf8', flag:'r'}); 6 | module.exports.params = { 7 | type: data, 8 | text: "Sample Text" 9 | } 10 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/Required.js: -------------------------------------------------------------------------------- 1 | module.exports.params = { 2 | bleu: { 3 | type: "STRING", 4 | required : true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/RequiredInvalidParam.js: -------------------------------------------------------------------------------- 1 | module.exports.params = { 2 | bleu: { 3 | type: "STRING", 4 | required : "Yes" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/RequiredParam.json: -------------------------------------------------------------------------------- 1 | { "bleu": { "type": "STRING", "required": true } } -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/Script.js: -------------------------------------------------------------------------------- 1 | module.exports.params = { 2 | sides: "NUMERIC" 3 | }; 4 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/JS/ScriptParam.json: -------------------------------------------------------------------------------- 1 | { "sides": "NUMERIC" } -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/ParamTestCase.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Unity.Services.Gateway.CloudCodeApiV1.Generated.Model; 3 | 4 | namespace Unity.Services.Cli.CloudCode.UnitTest.ScriptTestCases; 5 | 6 | public class ParamTestCase 7 | { 8 | public string Param { get; } 9 | 10 | public List? ExpectedParameters { get; } 11 | 12 | public ParamTestCase(string scriptName, List? parameters = null) 13 | { 14 | Param = TestResourceReader.ReadResourceFile(scriptName) 15 | .Replace(System.Environment.NewLine, "") 16 | .Replace(" ", ""); 17 | ExpectedParameters = parameters; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/ScriptTestCases/TestResourceReader.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Reflection; 3 | 4 | namespace Unity.Services.Cli.CloudCode.UnitTest.ScriptTestCases; 5 | 6 | static class TestResourceReader 7 | { 8 | const string k_TestJsNameSpace = "Unity.Services.Cli.CloudCode.UnitTest.ScriptTestCases.JS"; 9 | 10 | public static string ReadResourceFile(string fileName) 11 | { 12 | using var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream($"{k_TestJsNameSpace}.{fileName}"); 13 | using var reader = new StreamReader(stream!); 14 | return reader.ReadToEnd(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode.UnitTest/Utils/IoUtilsTests.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NUnit.Framework; 3 | 4 | namespace Unity.Services.Cli.CloudCode.UnitTest; 5 | 6 | [TestFixture] 7 | class IoUtilsTests 8 | { 9 | [Test] 10 | public void NormalizePath() 11 | { 12 | var rawPath = $"foo{Path.AltDirectorySeparatorChar}bar{Path.DirectorySeparatorChar}file.extension"; 13 | var expectedNormalizedPath = $"foo{Path.DirectorySeparatorChar}bar{Path.DirectorySeparatorChar}file.extension"; 14 | 15 | var normalizedPath = IoUtils.NormalizePath(rawPath); 16 | 17 | Assert.That(normalizedPath, Is.EqualTo(expectedNormalizedPath)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Authoring/Clients/ICSharpClient.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.CloudCode.Authoring; 2 | 3 | interface ICSharpClient : ICliCloudCodeClient { } 4 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Authoring/Clients/ICliCloudCodeClient.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.CloudCode.Authoring.Editor.Core.Deployment; 2 | 3 | namespace Unity.Services.Cli.CloudCode.Authoring; 4 | 5 | interface ICliCloudCodeClient : ICloudCodeClient 6 | { 7 | void Initialize(string environmentId, string projectId, CancellationToken cancellationToken); 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Authoring/Clients/IJavaScriptClient.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.CloudCode.Authoring; 2 | 3 | interface IJavaScriptClient : ICliCloudCodeClient { } 4 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Authoring/Fetch/IJavaScriptFetchHandler.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Authoring.Model; 2 | using Unity.Services.CloudCode.Authoring.Editor.Core.Model; 3 | 4 | namespace Unity.Services.Cli.CloudCode.Authoring; 5 | 6 | interface IJavaScriptFetchHandler 7 | { 8 | public Task FetchAsync( 9 | string rootDirectory, 10 | IReadOnlyList localResources, 11 | bool dryRun = false, 12 | bool reconcile = false, 13 | CancellationToken token = default); 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Authoring/Utils/CloudCodeScriptNameComparer.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.CloudCode.Authoring.Editor.Core.Model; 2 | 3 | namespace Unity.Services.Cli.CloudCode.Authoring; 4 | 5 | class CloudCodeScriptNameComparer : IEqualityComparer 6 | { 7 | public bool Equals(IScript? x, IScript? y) 8 | { 9 | if (ReferenceEquals(x, y)) 10 | return true; 11 | 12 | if (ReferenceEquals(x, null) 13 | || ReferenceEquals(y, null)) 14 | { 15 | return false; 16 | } 17 | 18 | return x.Name.Equals(y.Name); 19 | } 20 | 21 | public int GetHashCode(IScript obj) => obj.Name.GetHashCode(); 22 | } 23 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Authoring/Utils/ScriptExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using Unity.Services.CloudCode.Authoring.Editor.Core.Model; 3 | 4 | namespace Unity.Services.Cli.CloudCode; 5 | 6 | static class ScriptExtensions 7 | { 8 | public static void InjectJavaScriptParametersToBody(this IScript script, StringBuilder builder) 9 | { 10 | var javaScriptParams = script.Parameters.ToJavaScript(); 11 | builder.Clear() 12 | .AppendLine(script.Body) 13 | .AppendLine($"module.exports.params = {javaScriptParams};"); 14 | script.Body = builder.ToString(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Deploy/CloudCodeAuthoringLogger.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using ICloudCodeAuthoringLogger = Unity.Services.CloudCode.Authoring.Editor.Core.Logging.ILogger; 3 | 4 | namespace Unity.Services.Cli.CloudCode.Deploy; 5 | 6 | class CloudCodeAuthoringLogger : ICloudCodeAuthoringLogger 7 | { 8 | readonly ILogger m_Logger; 9 | 10 | public CloudCodeAuthoringLogger(ILogger logger) 11 | { 12 | m_Logger = logger; 13 | } 14 | 15 | public void LogError(object message) 16 | { 17 | } 18 | 19 | public void LogWarning(object message) 20 | { 21 | } 22 | 23 | public void LogInfo(object message) 24 | { 25 | } 26 | 27 | public void LogVerbose(object message) 28 | { 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Deploy/CloudCodeModulesDownloader.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.CloudCode.Deploy; 2 | 3 | class CloudCodeModulesDownloader : ICloudCodeModulesDownloader 4 | { 5 | readonly HttpClient m_HttpClient; 6 | public CloudCodeModulesDownloader(HttpClient client) => m_HttpClient = client; 7 | 8 | public Task DownloadModule( 9 | CloudCodeModule module, 10 | CancellationToken cancellationToken) 11 | { 12 | return m_HttpClient.GetStreamAsync(module.SignedUrl, cancellationToken); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Deploy/CloudCodeScriptLoadResult.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.CloudCode.Authoring.Editor.Core.Model; 2 | 3 | namespace Unity.Services.Cli.CloudCode.Deploy; 4 | 5 | class CloudCodeScriptLoadResult 6 | { 7 | public IReadOnlyList LoadedScripts { get; } 8 | public IReadOnlyList FailedContents { get; } 9 | 10 | public CloudCodeScriptLoadResult(IReadOnlyList loadedScripts, IReadOnlyList failedContents) 11 | { 12 | LoadedScripts = loadedScripts; 13 | FailedContents = failedContents; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Deploy/EnvironmentProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.CloudCode.Deploy; 2 | 3 | /// 4 | /// This provider will be consumed by the CloudCode Deploy handler 5 | /// (from the CloudCode.Authoring library) to cache the environment. 6 | /// 7 | class EnvironmentProvider : ICliEnvironmentProvider 8 | { 9 | public string Current { get; set; } = ""; 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Deploy/ICliEnvironmentProvider.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.CloudCode.Authoring.Editor.Core.Deployment; 2 | 3 | namespace Unity.Services.Cli.CloudCode.Deploy; 4 | 5 | interface ICliEnvironmentProvider : IEnvironmentProvider 6 | { 7 | new string Current { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Deploy/ICloudCodeModulesDownloader.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.CloudCode.Deploy; 2 | 3 | interface ICloudCodeModulesDownloader 4 | { 5 | Task DownloadModule( 6 | CloudCodeModule module, 7 | CancellationToken cancellationToken); 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Deploy/ICloudCodeModulesLoader.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.CloudCode.Authoring.Editor.Core.Model; 2 | 3 | namespace Unity.Services.Cli.CloudCode.Deploy; 4 | 5 | interface ICloudCodeModulesLoader 6 | { 7 | Task<(List, List)> LoadModulesAsync( 8 | IReadOnlyList ccmFilePaths, 9 | IReadOnlyList solutionFilePaths, 10 | CancellationToken cancellationToken); 11 | } 12 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Deploy/ICloudCodeScriptsLoader.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.CloudCode.Service; 2 | using Unity.Services.Cli.CloudCode.Parameters; 3 | 4 | namespace Unity.Services.Cli.CloudCode.Deploy; 5 | 6 | interface ICloudCodeScriptsLoader 7 | { 8 | Task LoadScriptsAsync( 9 | IReadOnlyCollection paths, 10 | string serviceType, 11 | string extension, 12 | ICloudCodeInputParser cloudCodeInputParser, 13 | ICloudCodeScriptParser cloudCodeScriptParser, 14 | CancellationToken cancellationToken); 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Deploy/ScriptNameJsonConverter.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Unity.Services.CloudCode.Authoring.Editor.Core.Model; 3 | 4 | namespace Unity.Services.Cli.CloudCode.Deploy; 5 | 6 | // This is needed as the ScriptName only has private fields 7 | class ScriptNameJsonConverter : JsonConverter 8 | { 9 | public override ScriptName ReadJson( 10 | JsonReader reader, 11 | Type objectType, 12 | ScriptName existingValue, 13 | bool hasExistingValue, 14 | JsonSerializer serializer) 15 | { 16 | return new ScriptName(reader.Value!.ToString()); 17 | } 18 | public override void WriteJson(JsonWriter writer, ScriptName value, JsonSerializer serializer) 19 | { 20 | writer.WriteValue(value.ToString()); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Handlers/ImportExport/Modules/ModuleExportHandler.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Authoring.Export.Input; 2 | using Unity.Services.Cli.Common.Console; 3 | 4 | namespace Unity.Services.Cli.CloudCode.Handlers.ImportExport.Modules; 5 | 6 | static class ModuleExportHandler 7 | { 8 | internal const string k_LoadingIndicatorMessage = "Exporting your environment..."; 9 | 10 | public static async Task ExportAsync( 11 | ExportInput exportInput, 12 | CloudCodeModulesExporter? cloudCodeModulesExporter, 13 | ILoadingIndicator loadingIndicator, 14 | CancellationToken cancellationToken) 15 | { 16 | await loadingIndicator.StartLoadingAsync( 17 | k_LoadingIndicatorMessage, 18 | _ => cloudCodeModulesExporter!.ExportAsync(exportInput, cancellationToken)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Handlers/ImportExport/Modules/ModulesImportHandler.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Authoring.Import.Input; 2 | using Unity.Services.Cli.Common.Console; 3 | 4 | namespace Unity.Services.Cli.CloudCode.Handlers.ImportExport.Modules; 5 | static class ModulesImportHandler 6 | { 7 | internal const string k_LoadingIndicatorMessage = "Importing Cloud Code modules..."; 8 | 9 | public static async Task ImportAsync( 10 | ImportInput importInput, 11 | CloudCodeModulesImporter? modulesImporter, 12 | ILoadingIndicator loadingIndicator, 13 | CancellationToken cancellationToken 14 | ) 15 | { 16 | await loadingIndicator.StartLoadingAsync( 17 | k_LoadingIndicatorMessage, 18 | _ => modulesImporter!.ImportAsync(importInput, cancellationToken)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Handlers/ImportExport/Scripts/ExportHandler.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Authoring.Export.Input; 2 | using Unity.Services.Cli.Common.Console; 3 | 4 | namespace Unity.Services.Cli.CloudCode.Handlers.ImportExport.Scripts; 5 | 6 | static class ExportHandler 7 | { 8 | internal const string k_LoadingIndicatorMessage = "Exporting your environment..."; 9 | 10 | public static async Task ExportAsync( 11 | ExportInput exportInput, 12 | CloudCodeScriptsExporter? cloudCodeScriptsExporter, 13 | ILoadingIndicator loadingIndicator, 14 | CancellationToken cancellationToken) 15 | { 16 | await loadingIndicator.StartLoadingAsync( 17 | k_LoadingIndicatorMessage, 18 | _ => cloudCodeScriptsExporter!.ExportAsync(exportInput, cancellationToken)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Handlers/ImportExport/Scripts/ImportHandler.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Authoring.Import.Input; 2 | using Unity.Services.Cli.Common.Console; 3 | 4 | namespace Unity.Services.Cli.CloudCode.Handlers.ImportExport.Scripts; 5 | 6 | static class ImportHandler 7 | { 8 | internal const string k_LoadingIndicatorMessage = "Importing Cloud Code scripts..."; 9 | 10 | public static async Task ImportAsync( 11 | ImportInput importInput, 12 | CloudCodeScriptsImporter? scriptsImporter, 13 | ILoadingIndicator loadingIndicator, 14 | CancellationToken cancellationToken) 15 | { 16 | await loadingIndicator.StartLoadingAsync( 17 | k_LoadingIndicatorMessage, 18 | _ => scriptsImporter!.ImportAsync(importInput, cancellationToken)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Handlers/ImportExport/Scripts/ScriptExportHandler.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Authoring.Export.Input; 2 | using Unity.Services.Cli.Common.Console; 3 | 4 | namespace Unity.Services.Cli.CloudCode.Handlers.ImportExport.Scripts; 5 | 6 | static class ScriptExportHandler 7 | { 8 | internal const string k_LoadingIndicatorMessage = "Exporting your environment..."; 9 | 10 | public static async Task ExportAsync( 11 | ExportInput exportInput, 12 | CloudCodeScriptsExporter? cloudCodeScriptsExporter, 13 | ILoadingIndicator loadingIndicator, 14 | CancellationToken cancellationToken) 15 | { 16 | await loadingIndicator.StartLoadingAsync( 17 | k_LoadingIndicatorMessage, 18 | _ => cloudCodeScriptsExporter!.ExportAsync(exportInput, cancellationToken)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/IO/AssemblyLoader.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace Unity.Services.Cli.CloudCode.IO; 4 | 5 | class AssemblyLoader : IAssemblyLoader 6 | { 7 | public Assembly Load(string assemblyString) 8 | { 9 | return Assembly.Load(assemblyString); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/IO/CloudCodeFileStream.cs: -------------------------------------------------------------------------------- 1 | using System.IO.Abstractions; 2 | using Unity.Services.CloudCode.Authoring.Editor.Core.IO; 3 | 4 | namespace Unity.Services.Cli.CloudCode.IO; 5 | 6 | class CloudCodeFileStream : IFileStream 7 | { 8 | internal FileSystemStream FileStream; 9 | public CloudCodeFileStream(FileSystemStream fileStream) 10 | { 11 | FileStream = fileStream; 12 | } 13 | 14 | public void Close() 15 | { 16 | FileStream.Close(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/IO/IAssemblyLoader.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace Unity.Services.Cli.CloudCode.IO; 4 | 5 | interface IAssemblyLoader 6 | { 7 | Assembly Load(string assemblyString); 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Model/ApiJsonProblem.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.CloudCode.Model; 2 | 3 | [Serializable] 4 | class ApiJsonProblem 5 | { 6 | public string? Type { get; set; } 7 | public string? Title { get; set; } 8 | public int Status { get; set; } 9 | public string? Detail { get; set; } 10 | public int Code { get; set; } 11 | public IList? Errors { get; set; } 12 | } 13 | 14 | [Serializable] 15 | class ApiJsonProblemError 16 | { 17 | public string? Field { get; set; } 18 | public IList? Messages { get; set; } 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Model/CloudListModuleResult.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | 3 | namespace Unity.Services.Cli.CloudCode.Model; 4 | 5 | public record CloudListModuleResult(string Name, DateTime? DateModified) 6 | { 7 | public override string ToString() 8 | { 9 | return $"{Name} - Date Modified: {DateModified?.ToString("s", CultureInfo.InvariantCulture) ?? "Never"}"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Model/CloudListScriptResult.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | 3 | namespace Unity.Services.Cli.CloudCode.Model; 4 | 5 | public record CloudListScriptResult(string Name, DateTime? DatePublished) 6 | { 7 | public override string ToString() 8 | { 9 | return $"{Name} - Date Created: {DatePublished?.ToString("s", CultureInfo.InvariantCulture) ?? "Never"}"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Model/DeletedCloudCode.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Authoring.Model; 2 | using Unity.Services.DeploymentApi.Editor; 3 | 4 | namespace Unity.Services.Cli.CloudCode.Model; 5 | 6 | class DeletedCloudCode : DeployContent 7 | { 8 | public DeletedCloudCode(string name, string type, string path, float progress = 0, DeploymentStatus? status = null) 9 | : base(name, type, path, progress, status) { } 10 | 11 | public override string ToString() 12 | { 13 | return $"'{Name}' - Deleted Remotely"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Model/ParseScriptParametersResult.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Gateway.CloudCodeApiV1.Generated.Model; 2 | 3 | namespace Unity.Services.Cli.CloudCode.Model; 4 | 5 | 6 | public class ParseScriptParametersResult 7 | { 8 | public bool ScriptContainsParametersJson { get; } 9 | public IReadOnlyList Parameters { get; } 10 | 11 | public ParseScriptParametersResult(bool scriptContainsParametersJson, IReadOnlyList parameters) 12 | { 13 | ScriptContainsParametersJson = scriptContainsParametersJson; 14 | Parameters = parameters; 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Parameters/ICloudCodeScriptParser.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.CloudCode.Model; 2 | using Unity.Services.Gateway.CloudCodeApiV1.Generated.Model; 3 | 4 | namespace Unity.Services.Cli.CloudCode.Parameters; 5 | 6 | public interface ICloudCodeScriptParser 7 | { 8 | /// 9 | /// Read script file and parse script parameters from script code 10 | /// 11 | /// script code 12 | /// token to cancel operation 13 | /// Result of the parameter parsing, containing a list of script parameters 14 | Task ParseScriptParametersAsync(string scriptCode, CancellationToken cancellationToken); 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Parameters/ICloudScriptParametersParser.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Gateway.CloudCodeApiV1.Generated.Model; 2 | 3 | namespace Unity.Services.Cli.CloudCode.Parameters; 4 | 5 | interface ICloudScriptParametersParser 6 | { 7 | public List ParseToScriptParameters(string parameterJsonString); 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Service/ICloudCodeInputParser.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.CloudCode.Input; 2 | using Unity.Services.Cli.CloudCode.Parameters; 3 | 4 | namespace Unity.Services.Cli.CloudCode.Service; 5 | 6 | interface ICloudCodeInputParser 7 | { 8 | public ICloudCodeScriptParser CloudCodeScriptParser { get; } 9 | 10 | public string ParseLanguage(CloudCodeInput input); 11 | 12 | public string ParseScriptType(CloudCodeInput input); 13 | 14 | public Task LoadScriptCodeAsync(CloudCodeInput input, CancellationToken cancellationToken); 15 | 16 | public Task LoadScriptCodeAsync(string filePath, CancellationToken cancellationToken); 17 | 18 | public Task LoadModuleContentsAsync(string filePath); 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Solution/TemplateInfo.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.CloudCode.Authoring.Editor.Core.Solution; 2 | 3 | namespace Unity.Services.Cli.CloudCode.Solution; 4 | 5 | class TemplateInfo : ITemplateInfo 6 | { 7 | public string PathSolution => @"Unity.Services.CloudCode.Authoring.Editor.Core.Solution.sln"; 8 | public string PathProject => @"Unity.Services.CloudCode.Authoring.Editor.Core.Project.csproj"; 9 | public string PathExampleClass => @"Unity.Services.CloudCode.Authoring.Editor.Core.Example.cs"; 10 | public string PathConfig => @"Unity.Services.CloudCode.Authoring.Editor.Core.FolderProfile.pubxml"; 11 | public string PathConfigUser => @"Unity.Services.CloudCode.Authoring.Editor.Core.FolderProfile.pubxml.user"; 12 | } 13 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Templates/CloudCodeTemplate.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using Unity.Services.Cli.Authoring.Templates; 3 | using Unity.Services.Cli.Common.Utils; 4 | 5 | namespace Unity.Services.Cli.CloudCode.Templates; 6 | 7 | public class CloudCodeTemplate : IFileTemplate 8 | { 9 | const string k_EmbeddedTemplateScript = "Unity.Services.Cli.CloudCode.JavaScripts.script_template.js"; 10 | 11 | public string Extension => ".js"; 12 | 13 | public string FileBodyText => ResourceFileHelper 14 | .ReadResourceFileAsync(Assembly.GetExecutingAssembly(), k_EmbeddedTemplateScript).Result; 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudCode/Utils/IoUtils.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.CloudCode; 2 | 3 | static class IoUtils 4 | { 5 | public static string NormalizePath(string path) 6 | => path.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar); 7 | } 8 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudContentDelivery/IO/FileSystem.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.CloudContentDelivery.Authoring.Core.IO; 2 | 3 | namespace Unity.Services.Cli.CloudContentDelivery.IO; 4 | 5 | class FileSystem : Common.IO.FileSystem, IFileSystem 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudContentDelivery/Model/ListBucketResult.cs: -------------------------------------------------------------------------------- 1 | using YamlDotNet.Serialization; 2 | using YamlDotNet.Serialization.NamingConventions; 3 | 4 | namespace Unity.Services.Cli.CloudContentDelivery.Model; 5 | 6 | public class ListBucketResult 7 | { 8 | public ListBucketResult(string id, string name) 9 | { 10 | Id = id; 11 | Name = name; 12 | } 13 | 14 | public string Id { get; set; } 15 | public string Name { get; set; } 16 | 17 | public override string ToString() 18 | { 19 | var serializer = new SerializerBuilder() 20 | .WithNamingConvention(CamelCaseNamingConvention.Instance) 21 | .DisableAliases() 22 | .Build(); 23 | return serializer.Serialize(this); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudContentDelivery/Model/ListEntryResult.cs: -------------------------------------------------------------------------------- 1 | using YamlDotNet.Serialization; 2 | using YamlDotNet.Serialization.NamingConventions; 3 | 4 | namespace Unity.Services.Cli.CloudContentDelivery.Model; 5 | 6 | public class ListEntryResult 7 | { 8 | public ListEntryResult(string id, string name) 9 | { 10 | Id = id; 11 | Name = name; 12 | } 13 | 14 | public string Id { get; set; } 15 | public string Name { get; set; } 16 | 17 | public override string ToString() 18 | { 19 | var serializer = new SerializerBuilder() 20 | .WithNamingConvention(CamelCaseNamingConvention.Instance) 21 | .DisableAliases() 22 | .Build(); 23 | return serializer.Serialize(this); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudContentDelivery/Model/ListReleaseResult.cs: -------------------------------------------------------------------------------- 1 | using YamlDotNet.Serialization; 2 | using YamlDotNet.Serialization.NamingConventions; 3 | 4 | namespace Unity.Services.Cli.CloudContentDelivery.Model; 5 | 6 | public class ListReleaseResult 7 | { 8 | public ListReleaseResult( 9 | string releaseId, 10 | long releaseNum) 11 | { 12 | ReleaseId = releaseId; 13 | ReleaseNum = releaseNum; 14 | } 15 | 16 | public string ReleaseId { get; set; } 17 | public long ReleaseNum { get; set; } 18 | 19 | public override string ToString() 20 | { 21 | var serializer = new SerializerBuilder() 22 | .WithNamingConvention(CamelCaseNamingConvention.Instance) 23 | .DisableAliases() 24 | .Build(); 25 | return serializer.Serialize(this); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudContentDelivery/Model/SharedRateLimitStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.CloudContentDelivery.Model; 2 | 3 | class SharedRateLimitStatus 4 | { 5 | public bool IsRateLimited { get; set; } 6 | public TimeSpan ResetTime { get; set; } = TimeSpan.Zero; 7 | 8 | public void UpdateRateLimit(bool rateLimited, TimeSpan resetTime) 9 | { 10 | IsRateLimited = rateLimited; 11 | ResetTime = resetTime; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudContentDelivery/Service/ClientWrapper.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.CloudContentDelivery.Service; 2 | 3 | public class ClientWrapper : IClientWrapper 4 | { 5 | public IReleaseClient? ReleaseClient { get; private set; } 6 | public IBadgeClient? BadgeClient { get; private set; } 7 | public IBucketClient? BucketClient { get; private set; } 8 | public IEntryClient? EntryClient { get; private set; } 9 | 10 | public ClientWrapper( 11 | IReleaseClient? releaseClient, 12 | IBadgeClient? badgeClient, 13 | IBucketClient? bucketClient, 14 | IEntryClient? entryClient) 15 | { 16 | ReleaseClient = releaseClient; 17 | BadgeClient = badgeClient; 18 | BucketClient = bucketClient; 19 | EntryClient = entryClient; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudContentDelivery/Service/IClientWrapper.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.CloudContentDelivery.Service; 2 | 3 | interface IClientWrapper 4 | { 5 | IReleaseClient? ReleaseClient { get; } 6 | IBadgeClient? BadgeClient { get; } 7 | IBucketClient? BucketClient { get; } 8 | IEntryClient? EntryClient { get; } 9 | } 10 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudContentDelivery/Service/IContentDeliveryValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.CloudContentDelivery.Service; 2 | 3 | public interface IContentDeliveryValidator 4 | { 5 | void ValidateProjectIdAndEnvironmentId(string projectId, string environmentId); 6 | void ValidateBucketId(string bucketId); 7 | void ValidateEntryId(string entryId); 8 | void ValidatePath(string path); 9 | } 10 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudContentDelivery/Service/IOperationSummary.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.CloudContentDelivery.Model; 2 | 3 | namespace Unity.Services.Cli.CloudContentDelivery.Service; 4 | 5 | public interface IOperationSummary 6 | { 7 | 8 | ReleaseResult? Release { get; } 9 | BadgeResult? Badge { get; } 10 | 11 | public string Operations { get; } 12 | public double SynchronizationTimeInSeconds { get; } 13 | 14 | public bool OperationCompletedSuccessfully { get; } 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudContentDelivery/Service/IUploadContentClient.cs: -------------------------------------------------------------------------------- 1 | using System.IO.Abstractions; 2 | 3 | namespace Unity.Services.Cli.CloudContentDelivery.Service; 4 | 5 | public interface IUploadContentClient 6 | { 7 | string GetContentType(string localPath); 8 | 9 | Task UploadContentToCcd( 10 | string signedUrl, 11 | FileSystemStream filestream, 12 | CancellationToken cancellationToken = default); 13 | 14 | string GetContentHash(FileSystemStream filestream); 15 | long GetContentSize(FileSystemStream filestream); 16 | } 17 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudSave.UnitTest/Utils/TestValues.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.CloudSave.UnitTest.Utils; 2 | 3 | static class TestValues 4 | { 5 | public const string ValidProjectId = "42a3e924-4bd9-41f8-adc9-59b18a032599"; 6 | 7 | public const string ValidEnvironmentId = "313b9230-3d52-4695-ac8f-cf9b49cf61fe"; 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudSave/IO/FileSystem.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.CloudSave.Authoring.Core.IO; 2 | 3 | namespace Unity.Services.Cli.CloudSave.IO; 4 | 5 | class FileSystem : Common.IO.FileSystem, IFileSystem { } 6 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudSave/Input/ListDataIdsInput.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.Common.Input; 3 | 4 | namespace Unity.Services.Cli.CloudSave.Input; 5 | 6 | class ListDataIdsInput : CommonInput 7 | { 8 | public static readonly Option StartOption = new Option("--start", "The custom data ID to start the page from. If not specified, the first page will be returned."); 9 | [InputBinding(nameof(StartOption))] 10 | public string? Start { get; set; } 11 | 12 | public static readonly Option LimitOption = new Option("--limit", "The maximum number of custom data IDs to return. If not specified, the default limit of 20 will be used."); 13 | [InputBinding(nameof(LimitOption))] 14 | public int? Limit { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudSave/Models/CreateIndexOutput.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Unity.Services.Gateway.CloudSaveApiV1.Generated.Model; 3 | 4 | namespace Unity.Services.Cli.CloudSave.Models; 5 | 6 | public class CreateIndexOutput 7 | { 8 | public IndexStatus Status { get; set; } 9 | public string Id { get; set; } 10 | 11 | public CreateIndexOutput(CreateIndexResponse response) 12 | { 13 | Status = response.Status; 14 | Id = response.Id; 15 | } 16 | 17 | public override string ToString() 18 | { 19 | return $"Index with ID \"{Id}\" successfully created with status \"{Status}\"."; 20 | } 21 | 22 | public string ToJson() 23 | { 24 | return JsonConvert.SerializeObject(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudSave/Utils/CustomIndexVisibilityTypes.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.CloudSave.Utils; 2 | 3 | static class CustomIndexVisibilityTypes 4 | { 5 | public const string Default = "default"; 6 | public const string Private = "private"; 7 | 8 | public static bool IsValidType(string? type) 9 | { 10 | return type is Default or Private; 11 | } 12 | 13 | public static IEnumerable GetTypes() 14 | { 15 | return new List { Default, Private }; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.CloudSave/Utils/PlayerIndexVisibilityTypes.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.CloudSave.Utils; 2 | 3 | static class PlayerIndexVisibilityTypes 4 | { 5 | public const string Default = "default"; 6 | public const string Public = "public"; 7 | public const string Protected = "protected"; 8 | 9 | public static bool IsValidType(string? type) 10 | { 11 | return type is Default or Public or Protected; 12 | } 13 | 14 | public static IEnumerable GetTypes() 15 | { 16 | return new List { Default, Public, Protected }; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common.UnitTest/Console/MockLoadingExclusiveMode.cs: -------------------------------------------------------------------------------- 1 | using Spectre.Console; 2 | 3 | namespace Unity.Services.Cli.Common.UnitTest.Console; 4 | 5 | public class MockLoadingExclusiveMode : IExclusivityMode 6 | { 7 | readonly Func m_Action; 8 | 9 | public MockLoadingExclusiveMode(Func action) 10 | { 11 | m_Action = action; 12 | } 13 | 14 | public T Run(Func func) 15 | { 16 | throw new NotImplementedException(); 17 | } 18 | 19 | public async Task RunAsync(Func> func) 20 | { 21 | await m_Action(null).ConfigureAwait(false); 22 | 23 | return await Task.FromResult(default!); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common.UnitTest/Console/MockProgressExclusiveMode.cs: -------------------------------------------------------------------------------- 1 | using Spectre.Console; 2 | 3 | namespace Unity.Services.Cli.Common.UnitTest.Console; 4 | 5 | public class MockProgressExclusiveMode : IExclusivityMode 6 | { 7 | readonly Func m_Action; 8 | 9 | public MockProgressExclusiveMode(Func action) 10 | { 11 | m_Action = action; 12 | } 13 | 14 | public T Run(Func func) 15 | { 16 | throw new NotImplementedException(); 17 | } 18 | 19 | public async Task RunAsync(Func> func) 20 | { 21 | await m_Action(null).ConfigureAwait(false); 22 | 23 | return await Task.FromResult(default!); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common.UnitTest/Models/DummyModule.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | 3 | namespace Unity.Services.Cli.Common.UnitTest; 4 | 5 | /// 6 | /// Dummy implementation of to test its default implementations. 7 | /// 8 | /// 9 | /// Can't use Mock as it overrides default behaviours. 10 | /// 11 | class DummyModule : ICommandModule 12 | { 13 | public Command? ModuleRootCommand { get; init; } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common.UnitTest/Networking/RequestHeaderHelperTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using Unity.Services.Cli.Common.Networking; 3 | 4 | namespace Unity.Services.Cli.Common.UnitTest; 5 | 6 | [TestFixture] 7 | class RequestHeaderHelperTests 8 | { 9 | [Test] 10 | public void SetAccessTokenHeaderCreatesEntryIfNoneExist() 11 | { 12 | var map = new Dictionary(); 13 | map.SetXClientIdHeader(); 14 | 15 | Assert.IsTrue(map.TryGetValue(RequestHeaderHelper.XClientIdHeaderKey, out var requestHeader)); 16 | Assert.AreEqual(RequestHeaderHelper.XClientIdHeaderValue, requestHeader); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Binding/ServiceBinder.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine.Binding; 2 | using Microsoft.Extensions.DependencyInjection; 3 | 4 | namespace Unity.Services.Cli.Common; 5 | 6 | /// 7 | /// Helper to retrieve a service from a binding context when declaring a command handler. 8 | /// 9 | /// 10 | /// Any type that has been provided to the binding context. 11 | /// 12 | public sealed class ServiceBinder : BinderBase 13 | { 14 | public static ServiceBinder Instance { get; } = new(); 15 | 16 | ServiceBinder() { } 17 | 18 | protected override T GetBoundValue(BindingContext bindingContext) 19 | => (T)bindingContext.GetRequiredService(typeof(T)); 20 | } 21 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Configuration/Handlers/SetHandler.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using Unity.Services.Cli.Common.Input; 3 | 4 | namespace Unity.Services.Cli.Common.Handlers; 5 | 6 | static class SetHandler 7 | { 8 | public static async Task SetAsync( 9 | ConfigurationInput input, IConfigurationService service, ILogger logger, CancellationToken cancellationToken) 10 | { 11 | await service.SetConfigArgumentsAsync(input.Key ?? "", input.Value!, cancellationToken); 12 | 13 | logger.LogInformation("The config '{key}' has been set to '{value}'.", input.Key, input.Value); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Configuration/Service/IConfigurationService.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common; 2 | 3 | public interface IConfigurationService 4 | { 5 | public Task SetConfigArgumentsAsync(string key, string value, CancellationToken cancellationToken = default); 6 | public Task GetConfigArgumentsAsync(string key, CancellationToken cancellationToken = default); 7 | public Task DeleteConfigArgumentsAsync(string[] keys, CancellationToken cancellationToken = default); 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Configuration/Validator/IConfigurationValidator.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Validator; 2 | 3 | public interface IConfigurationValidator 4 | { 5 | bool IsConfigValid(string key, string? value, out string errorMessage); 6 | 7 | bool IsKeyValid(string key, out string errorMessage); 8 | 9 | void ThrowExceptionIfConfigInvalid(string key, string value); 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Console/IConsoleTable.cs: -------------------------------------------------------------------------------- 1 | using Spectre.Console; 2 | 3 | namespace Unity.Services.Cli.Common.Console; 4 | 5 | public interface IConsoleTable 6 | { 7 | void DrawTable(); 8 | void AddColumn(Text title); 9 | void AddColumns(params Text[] titles); 10 | void AddRow(params Text[] items); 11 | void RemoveRow(int index); 12 | IReadOnlyList GetColumns(); 13 | IReadOnlyList GetRows(); 14 | void SetTitle(TableTitle title); 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Console/ILoadingIndicator.cs: -------------------------------------------------------------------------------- 1 | using Spectre.Console; 2 | 3 | namespace Unity.Services.Cli.Common.Console; 4 | 5 | public interface ILoadingIndicator 6 | { 7 | /// 8 | /// Method used to show a loading indicator with a description on the console. 9 | /// 10 | /// Description of the loading indicator 11 | /// The callback that the status will be tracking 12 | /// 13 | Task StartLoadingAsync(string description, Func callback); 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Console/IProgressBar.cs: -------------------------------------------------------------------------------- 1 | using Spectre.Console; 2 | 3 | namespace Unity.Services.Cli.Common.Console; 4 | 5 | public interface IProgressBar 6 | { 7 | /// 8 | /// Method used to show progress bars on the console. 9 | /// 10 | /// The callback that the progress bars will be tracking 11 | /// 12 | Task StartProgressAsync(Func callback); 13 | } 14 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Console/LoadingIndicator.cs: -------------------------------------------------------------------------------- 1 | using Spectre.Console; 2 | 3 | namespace Unity.Services.Cli.Common.Console; 4 | 5 | public class LoadingIndicator : ILoadingIndicator 6 | { 7 | internal readonly IAnsiConsole? AnsiConsole; 8 | 9 | public LoadingIndicator(IAnsiConsole? console) 10 | { 11 | AnsiConsole = console; 12 | } 13 | 14 | public async Task StartLoadingAsync(string description, Func callback) 15 | { 16 | await (AnsiConsole is null ? callback(null) : StartAnsiConsoleStatusAsync(AnsiConsole, description, callback)); 17 | } 18 | 19 | static async Task StartAnsiConsoleStatusAsync(IAnsiConsole console, string description, Func callback) => 20 | await console.Status().StartAsync(description, callback); 21 | } 22 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Exceptions/CliException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace Unity.Services.Cli.Common.Exceptions; 4 | 5 | /// 6 | /// Exception caused by user operation. The exception message should include instructions to fix operation 7 | /// 8 | public class CliException : Exception 9 | { 10 | public int ExitCode { get; } 11 | 12 | public CliException(string message, Exception? innerException, int exitCode) 13 | : base(message, innerException) 14 | { 15 | ExitCode = exitCode; 16 | } 17 | 18 | public CliException(string message, int exitCode) 19 | : this(message, null, exitCode) { } 20 | 21 | public CliException(int exitCode) 22 | : this("", null, exitCode) { } 23 | } 24 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Exceptions/ConfigValidationException.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Exceptions; 2 | 3 | public class ConfigValidationException : CliException 4 | { 5 | public string Key { get; } 6 | public string? Value { get; } 7 | 8 | public ConfigValidationException(string key, string? value, string message, int exitCode = Exceptions.ExitCode.HandledError) 9 | : base($"Your {key} is not valid. {message}", exitCode) 10 | { 11 | Key = key; 12 | Value = value; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Exceptions/DeploymentFailureException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace Unity.Services.Cli.Common.Exceptions; 4 | 5 | /// 6 | /// Exception caused by a failure in the deployment process 7 | /// 8 | public class DeploymentFailureException : Exception 9 | { 10 | public int ExitCode { get; } 11 | 12 | public DeploymentFailureException() 13 | : base("", null) 14 | { 15 | ExitCode = Common.Exceptions.ExitCode.HandledError; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Exceptions/EnvironmentNotFoundException.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Exceptions; 2 | 3 | public class EnvironmentNotFoundException : CliException 4 | { 5 | public EnvironmentNotFoundException(string environmentName, int exitCode) 6 | : base($"The environment '{environmentName}' could not be found." + 7 | " Please re-enter a valid environment name.", exitCode) 8 | { } 9 | } 10 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Input/InputBindingAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Input; 2 | 3 | /// 4 | /// An attribute to automatically bind a command input to a property or field. 5 | /// 6 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] 7 | public class InputBindingAttribute : Attribute 8 | { 9 | /// 10 | /// Name of the input to bind to the decorated member. 11 | /// 12 | public string InputName { get; } 13 | 14 | /// 15 | /// Create an attribute to bind an input to a field or a property. 16 | /// 17 | /// 18 | /// Name of the input to bind to the decorated member. 19 | /// 20 | public InputBindingAttribute(string name) 21 | { 22 | InputName = name; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Logging/JsonLogMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Logging; 2 | 3 | [Serializable] 4 | class JsonLogMessage 5 | { 6 | public string? Message { get; set; } 7 | public string? Type { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Logging/LogConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | 3 | namespace Unity.Services.Cli.Common.Logging; 4 | 5 | public class LogConfiguration 6 | { 7 | public bool IsJson { get; set; } 8 | public bool IsQuiet { get; set; } 9 | 10 | public Dictionary LogLevels => new() 11 | { 12 | [LogLevel.Information] = ConsoleColor.Green, 13 | [LogLevel.Warning] = ConsoleColor.DarkYellow, 14 | [LogLevel.Error] = ConsoleColor.DarkRed, 15 | [LogLevel.Critical] = ConsoleColor.Red 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Logging/LogFormatter/ILogFormatter.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Logging; 2 | 3 | /// 4 | /// Each log formatter should implement this interface 5 | /// 6 | public interface ILogFormatter 7 | { 8 | /// 9 | /// Prints log to the console using the correct format 10 | /// 11 | /// cache containing the logs to be printed 12 | public void WriteLog(LogCache logCache); 13 | } 14 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Logging/LogMessage.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | 3 | namespace Unity.Services.Cli.Common.Logging; 4 | 5 | public class LogMessage 6 | { 7 | public string? Name { get; set; } 8 | public string? Message { get; set; } 9 | public LogLevel Type { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Logging/LoggerExtension.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | 3 | namespace Unity.Services.Cli.Common.Logging; 4 | 5 | public static class LoggerExtension 6 | { 7 | public const string ResultEventName = "Operation Result"; 8 | 9 | public static readonly EventId ResultEventId = new(1000, ResultEventName); 10 | 11 | public static void LogResultValue( 12 | this ILogger logger, object value, Exception? exception = default, params object?[] args) 13 | { 14 | logger.Log(LogLevel.Critical, ResultEventId, value, exception, null!); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Networking/CliNetworkEnvironment.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Networking; 2 | 3 | /// 4 | /// The different network environment supported by the CLI. 5 | /// 6 | public enum CliNetworkEnvironment 7 | { 8 | /// 9 | /// Default environment. 10 | /// 11 | Production, 12 | /// 13 | /// Environment enabled when the USE_STAGING_ENDPOINTS constant is defined. 14 | /// 15 | Staging, 16 | /// 17 | /// Environment enabled when the USE_MOCKSERVER_ENDPOINTS constant is defined. 18 | /// 19 | MockServer, 20 | } 21 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Networking/Endpoints/CloudCodeEndpoints.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Networking; 2 | 3 | public class CloudCodeEndpoints : NetworkTargetEndpoints 4 | { 5 | protected override string Prod { get; } = "https://services.api.unity.com"; 6 | 7 | protected override string Staging { get; } = "https://staging.services.api.unity.com"; 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Networking/Endpoints/CloudContentDeliveryEndpoints.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Networking; 2 | 3 | public class CloudContentDeliveryApiEndpoints : NetworkTargetEndpoints 4 | { 5 | protected override string Prod { get; } = "https://services.api.unity.com"; 6 | 7 | protected override string Staging { get; } = "https://staging.services.api.unity.com"; 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Networking/Endpoints/CloudSaveEndpoints.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Networking; 2 | 3 | public class CloudSaveEndpoints : NetworkTargetEndpoints 4 | { 5 | protected override string Prod { get; } = "https://services.api.unity.com"; 6 | 7 | protected override string Staging { get; } = "https://staging.services.api.unity.com"; 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Networking/Endpoints/LeaderboardEndpoints.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Networking; 2 | 3 | public class LeaderboardEndpoints : NetworkTargetEndpoints 4 | { 5 | protected override string Prod { get; } = "https://services.api.unity.com"; 6 | 7 | protected override string Staging { get; } = "https://staging.services.api.unity.com"; 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Networking/Endpoints/LobbyApiEndpoints.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Networking; 2 | 3 | /// 4 | /// Endpoints used to reach the Lobby service. 5 | /// 6 | public class LobbyApiEndpoints : NetworkTargetEndpoints 7 | { 8 | protected override string Prod { get; } = "https://lobby.services.api.unity.com/v1"; 9 | 10 | protected override string Staging { get; } = "https://lobby-stg.services.api.unity.com/v1"; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Networking/Endpoints/SchedulerEndpoints.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Networking; 2 | 3 | public class SchedulerEndpoints : NetworkTargetEndpoints 4 | { 5 | protected override string Prod { get; } = "https://services.api.unity.com"; 6 | 7 | protected override string Staging { get; } = "https://staging.services.api.unity.com"; 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Networking/Endpoints/TelemetryApiEndpoints.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Networking; 2 | 3 | /// 4 | /// Endpoints used to reach the Unity Telemetry Services. 5 | /// 6 | public class TelemetryApiEndpoints : NetworkTargetEndpoints 7 | { 8 | protected override string Prod { get; } = "https://operate-sdk-telemetry.unity3d.com/"; 9 | 10 | protected override string Staging { get; } = "https://sdk-telemetry.stg.mz.internal.unity3d.com/"; 11 | } 12 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Networking/Endpoints/TriggersEndpoints.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Networking; 2 | 3 | public class TriggersEndpoints : NetworkTargetEndpoints 4 | { 5 | protected override string Prod { get; } = "https://services.api.unity.com"; 6 | 7 | protected override string Staging { get; } = "https://staging.services.api.unity.com"; 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Networking/Endpoints/UnityServicesGatewayEndpoints.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Networking; 2 | 3 | /// 4 | /// Endpoints used to reach the Unity Services Gateway. 5 | /// 6 | public sealed class UnityServicesGatewayEndpoints : NetworkTargetEndpoints 7 | { 8 | protected override string Prod { get; } = "https://services.api.unity.com"; 9 | 10 | protected override string Staging { get; } = "https://staging.services.api.unity.com"; 11 | } 12 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Persister/IPersister.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Persister; 2 | 3 | public interface IPersister 4 | { 5 | /// 6 | /// Try to load the persisted value if any. 7 | /// 8 | /// 9 | /// Returns the loaded value if any were saved; 10 | /// returns default otherwise. 11 | /// 12 | Task LoadAsync(CancellationToken cancellationToken = default); 13 | 14 | Task SaveAsync(T data, CancellationToken cancellationToken = default); 15 | 16 | Task DeleteAsync(CancellationToken cancellationToken = default); 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Process/ProcessException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using Unity.Services.Cli.Common.Exceptions; 3 | 4 | namespace Unity.Services.Cli.Common.Process; 5 | 6 | public class ProcessException : CliException 7 | { 8 | public ProcessException(string message, Exception? innerException, int exitCode) : base(message, innerException, exitCode) 9 | { 10 | } 11 | 12 | public ProcessException(string message, int exitCode = Exceptions.ExitCode.HandledError) : base(message, exitCode) 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Services/IServiceTypeList.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Services; 2 | 3 | public interface IServiceTypeList 4 | { 5 | IReadOnlyList ServiceTypes { get; } 6 | } 7 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/SystemEnvironment/ISystemEnvironmentProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.SystemEnvironment; 2 | 3 | public interface ISystemEnvironmentProvider 4 | { 5 | /// 6 | /// Based on a given key, returns a value from system environment variable 7 | /// 8 | /// The key of the system environment variable to fetch 9 | /// Error message generated while fetching from system environment variables 10 | /// The value of the system environment variable that was fetched, null if the key is not set 11 | public string? GetSystemEnvironmentVariable(string key, out string errorMsg); 12 | } 13 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Telemetry/AnalyticEvent/AnalyticEventFactory/IAnalyticEventFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Unity.Services.Cli.Common.Telemetry.AnalyticEvent.AnalyticEventFactory; 4 | 5 | public interface IAnalyticEventFactory 6 | { 7 | string ProjectId { get; set; } 8 | 9 | IAnalyticEvent CreateMetricEvent(); 10 | IAnalyticEvent CreateDiagnosticEvent(); 11 | } 12 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Telemetry/AnalyticEvent/AnalyticEventUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.CommandLine.Parsing; 3 | 4 | namespace Unity.Services.Cli.Common.Telemetry.AnalyticEvent; 5 | 6 | public static class AnalyticEventUtils 7 | { 8 | public static string ConvertSymbolResultToString(SymbolResult symbol) 9 | { 10 | List symbolNames = new(); 11 | while (symbol is not null) 12 | { 13 | symbolNames.Add(symbol.Symbol.Name); 14 | symbol = symbol.Parent!; 15 | } 16 | symbolNames.Reverse(); 17 | 18 | if (symbolNames.FirstOrDefault() != null) 19 | { 20 | symbolNames[0] = "ugs"; 21 | } 22 | 23 | return string.Join("_", symbolNames); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Telemetry/AnalyticEvent/IAnalyticEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Unity.Services.Cli.Common.Telemetry.AnalyticEvent; 4 | 5 | public interface IAnalyticEvent 6 | { 7 | public void AddData(string key, object value); 8 | public void Send(); 9 | } 10 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Telemetry/AnalyticEvent/IAnalyticsEventBuilder.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Telemetry.AnalyticEvent; 2 | 3 | public interface IAnalyticsEventBuilder 4 | { 5 | public void SetCommandName(string name); 6 | public void AddCommandOption(string optionName); 7 | public void AddAuthoringServiceProcessed(string service); 8 | public void SetAuthoringCommandlinePathsInputCount(IReadOnlyList filePaths); 9 | public void SendCommandCompletedEvent(); 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Telemetry/DiagnosticsTagKeys.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Telemetry; 2 | 3 | static class DiagnosticsTagKeys 4 | { 5 | public const string DiagnosticName = "name"; 6 | 7 | public const string DiagnosticMessage = "message"; 8 | 9 | public const string Command = "cli_full_command"; 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Common/Telemetry/MetricTagKeys.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Common.Telemetry; 2 | 3 | static class MetricTagKeys 4 | { 5 | public const string Command = "command"; 6 | 7 | public const string Options = "options"; 8 | 9 | public const string ServicesProcessed = "authoring_services_processed"; 10 | 11 | public const string NbFilePaths = "nb_file_paths_in_commandline"; 12 | 13 | public const string NbFolderPaths = "nb_folder_paths_in_commandline"; 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Economy.UnitTest/Utils/TestValues.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Economy.UnitTest.Utils; 2 | 3 | static class TestValues 4 | { 5 | public const string ValidProjectId = "42a3e924-4bd9-41f8-adc9-59b18a032599"; 6 | 7 | public const string ValidEnvironmentId = "313b9230-3d52-4695-ac8f-cf9b49cf61fe"; 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Economy/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("Unity.Services.Cli.Economy.UnitTest")] 4 | [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] 5 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Economy/Authoring/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Economy.Authoring; 2 | 3 | static class Constants 4 | { 5 | public const string ServiceType = "Economy"; 6 | public const string ServiceName = "economy"; 7 | } 8 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Economy/Authoring/ICliEconomyClient.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Economy.Editor.Authoring.Core.Service; 2 | 3 | namespace Unity.Services.Cli.Economy.Authoring; 4 | 5 | interface ICliEconomyClient : IEconomyClient 6 | { 7 | void Initialize(string environmentId, string projectId, CancellationToken cancellationToken); 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Economy/Authoring/IO/EconomyJsonConverter.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Unity.Services.Cli.Economy.Templates; 3 | using Unity.Services.Economy.Editor.Authoring.Core.IO; 4 | 5 | namespace Unity.Services.Cli.Economy.Authoring.IO; 6 | 7 | class EconomyJsonConverter : IEconomyJsonConverter 8 | { 9 | public T? DeserializeObject(string value) 10 | { 11 | return JsonConvert.DeserializeObject(value); 12 | } 13 | 14 | public string SerializeObject(object? value) 15 | { 16 | return JsonConvert.SerializeObject(value, EconomyResourceFile.GetSerializationSettings()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Economy/Authoring/IO/FileSystem.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Economy.Editor.Authoring.Core.IO; 2 | 3 | namespace Unity.Services.Cli.Economy.Authoring.IO; 4 | 5 | class FileSystem : Common.IO.FileSystem, IFileSystem { } 6 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Economy/Exceptions/InvalidResourceException.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Gateway.EconomyApiV2.Generated.Client; 2 | 3 | namespace Unity.Services.Cli.Economy.Exceptions; 4 | 5 | public class InvalidResourceException : ApiException 6 | { 7 | public InvalidResourceException(string message, Exception innerException) 8 | : base(Common.Exceptions.ExitCode.HandledError, $"Economy resource file is invalid: {message}", innerException) { } 9 | } 10 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Economy/Input/EconomyInput.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.Common.Input; 3 | 4 | namespace Unity.Services.Cli.Economy.Input; 5 | 6 | class EconomyInput : CommonInput 7 | { 8 | public static readonly Argument ResourceIdArgument = 9 | new("resource-id", "ID of the Economy resource"); 10 | 11 | [InputBinding(nameof(ResourceIdArgument))] 12 | public string? ResourceId { get; set; } 13 | 14 | public static readonly Argument ResourceFilePathArgument = 15 | new("file-path", "File path of the resource to add"); 16 | 17 | [InputBinding(nameof(ResourceFilePathArgument))] 18 | public string? FilePath { get; set; } 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Economy/Model/EconomyResourcesResponseResult.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Linq; 3 | using Unity.Services.Gateway.EconomyApiV2.Generated.Model; 4 | 5 | namespace Unity.Services.Cli.Economy.Model; 6 | 7 | class EconomyResourcesResponseResult 8 | { 9 | public List Resources; 10 | 11 | public EconomyResourcesResponseResult(List resources) 12 | { 13 | Resources = resources; 14 | } 15 | 16 | public override string ToString() 17 | { 18 | var jsonString = JsonConvert.SerializeObject(Resources); 19 | var formattedJson = JToken.Parse(jsonString).ToString(Formatting.Indented); 20 | return formattedJson; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Economy/Model/Resource.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Unity.Services.Cli.Economy.Model; 4 | 5 | class Resource 6 | { 7 | [JsonProperty("id")] [JsonRequired] public string Id; 8 | [JsonProperty("name")] [JsonRequired] public string Name; 9 | [JsonProperty("type")] [JsonRequired] public string Type; 10 | [JsonProperty("customData")] public object? CustomData; 11 | 12 | public Resource(string id, string name, string type, object? customData) 13 | { 14 | Id = id; 15 | Name = name; 16 | Type = type; 17 | CustomData = customData; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Economy/Templates/IEconomyResourceFile.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Unity.Services.Cli.Economy.Templates; 4 | 5 | interface IEconomyResourceFile 6 | { 7 | public string? Id { get; set; } 8 | [JsonRequired] 9 | public string Name { get; set; } 10 | 11 | [JsonIgnore] //specialized class will set this field, it should not be stored as it is inferred from the file-type 12 | public string Type { get; set; } 13 | public object? CustomData { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Economy/Utils/EconomyResourceTypes.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Economy.Utils; 2 | 3 | static class EconomyResourceTypes 4 | { 5 | public const string InventoryItem = "INVENTORY_ITEM"; 6 | public const string Currency = "CURRENCY"; 7 | public const string VirtualPurchase = "VIRTUAL_PURCHASE"; 8 | public const string MoneyPurchase = "MONEY_PURCHASE"; 9 | } 10 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Environment/Input/EnvironmentInput.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.Common.Input; 3 | 4 | namespace Unity.Services.Cli.Environment.Input; 5 | 6 | public class EnvironmentInput : CommonInput 7 | { 8 | public static readonly Argument EnvironmentNameArgument = new("environment-name", "The services environment name"); 9 | 10 | [InputBinding(nameof(EnvironmentNameArgument))] 11 | public string? EnvironmentName { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/Input/BuildConfigurationIdInputTests.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.GameServerHosting.Input; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.UnitTest.Input; 5 | 6 | public class BuildConfigurationIdInputTests 7 | { 8 | [TestCase("alphaString", false)] 9 | [TestCase("123456", true)] 10 | public void Validate_WithValidUUIDInput_ReturnsTrue(string buildConfiguratinId, bool validates) 11 | { 12 | Assert.That(BuildConfigurationIdInput.BuildConfigurationIdArgument.Parse(buildConfiguratinId).Errors, validates ? Is.Empty : Is.Not.Empty); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/Input/BuildConfigurationListInputTests.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.GameServerHosting.Input; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.UnitTest.Input; 5 | 6 | public class BuildConfigurationInputTests 7 | { 8 | [TestCase(InvalidUuid, false)] 9 | [TestCase(ValidFleetId, true)] 10 | public void Validate_WithValidUUIDInput_ReturnsTrue(string fleetId, bool validates) 11 | { 12 | var arg = new[] 13 | { 14 | BuildConfigurationListInput.FleetIdKey, 15 | fleetId, 16 | }; 17 | Assert.That(BuildConfigurationListInput.FleetIdOption.Parse(arg).Errors, validates ? Is.Empty : Is.Not.Empty); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/Input/BuildIdInputTests.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.GameServerHosting.Input; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.UnitTest.Input; 5 | 6 | public class BuildIdInputTests 7 | { 8 | [TestCase("alphaString", false)] 9 | [TestCase("123456", true)] 10 | public void Validate_WithValidUUIDInput_ReturnsTrue(string buildId, bool validates) 11 | { 12 | Assert.That(BuildIdInput.BuildIdArgument.Parse(buildId).Errors, validates ? Is.Empty : Is.Not.Empty); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/Input/CoreDumpCreateInputTest.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.GameServerHosting.Input; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.UnitTest.Input; 5 | 6 | [TestFixture] 7 | [TestOf(typeof(CoreDumpCreateInput))] 8 | public class CoreDumpCreateInputTest 9 | { 10 | [TestCase("disabled", true)] 11 | [TestCase("enabled", true)] 12 | [TestCase("unavailable", false)] 13 | public void ValidateStateOption(string state, bool valid) 14 | { 15 | var args = new[] 16 | { 17 | CoreDumpCreateInput.StateOption.Aliases.First(), 18 | state 19 | }; 20 | Assert.That(CoreDumpCreateInput.StateOption.Parse(args).Errors, valid ? Is.Empty : Is.Not.Empty); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/Input/FleetIdInputTests.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.GameServerHosting.Input; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.UnitTest.Input; 5 | 6 | public class FleetIdInputTests 7 | { 8 | [TestCase(InvalidUuid, false)] 9 | [TestCase(ValidFleetId,true)] 10 | public void Validate_WithValidUUIDInput_ReturnsTrue(string regions, bool validates) 11 | { 12 | Assert.That(FleetIdInput.FleetIdArgument.Parse(regions).Errors, validates ? Is.Empty : Is.Not.Empty); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/Input/FleetUpdateInputTests.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.GameServerHosting.Input; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.UnitTest.Input; 5 | 6 | [TestFixture] 7 | public class FleetUpdateInputTests 8 | { 9 | [TestCase(new[] 10 | { 11 | FleetUpdateInput.UsageSettingsKey, 12 | "badjson" 13 | }, false)] 14 | [TestCase(new[] 15 | { 16 | FleetUpdateInput.UsageSettingsKey, 17 | ValidUsageSettingsJson 18 | }, true)] 19 | public void Validate_WithValidUsageSettings_ReturnsTrue(string[] usageSetting, bool validates) 20 | { 21 | Assert.That(FleetUpdateInput.UsageSettingsOption.Parse(usageSetting).Errors, validates ? Is.Empty : Is.Not.Empty); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/Input/ServerIdInputTests.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.GameServerHosting.Input; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.UnitTest.Input; 5 | 6 | public class ServerIdInputTests 7 | { 8 | [TestCase("nan", false)] 9 | [TestCase("666", true)] 10 | public void Validate_WithValidServerIdInput_ReturnsTrue(string serverId, bool validates) 11 | { 12 | Assert.That(ServerIdInput.ServerIdArgument.Parse(serverId).Errors, validates ? Is.Empty : Is.Not.Empty); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/Services/CcdHashExtensionsTests.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using System.Text.RegularExpressions; 3 | using Unity.Services.Multiplay.Authoring.Core.CloudContent; 4 | 5 | namespace Unity.Services.Cli.GameServerHosting.UnitTest.Services; 6 | 7 | public class CcdHashExtensionsTests 8 | { 9 | [Test] 10 | public void Hash_ReturnsLowerHex() 11 | { 12 | var data = new MemoryStream(Encoding.UTF8.GetBytes("hello world!")); 13 | var hash = data.CcdHash(); 14 | 15 | Assert.IsTrue(Regex.IsMatch(hash, "^[a-fA-F0-9]+$")); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/Services/DummyBinaryBuilderTests.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.GameServerHosting.Services; 2 | 3 | namespace Unity.Services.Cli.GameServerHosting.UnitTest.Services; 4 | 5 | public class DummyBinaryBuilderTests 6 | { 7 | [Test] 8 | public void BuildLinuxServer_ReturnsPath() 9 | { 10 | var build = new DummyBinaryBuilder().BuildLinuxServer("dir", "name"); 11 | 12 | Assert.That(build.Path.Contains("dir")); 13 | Assert.That(build.Path.Contains("name")); 14 | } 15 | 16 | [Test] 17 | public void RevertToOriginalBuildTarget_DoesNothing() 18 | { 19 | Assert.DoesNotThrow(() => 20 | { 21 | new DummyBinaryBuilder().WarnBuildTargetChanged(); 22 | }); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting.UnitTest/Usings.cs: -------------------------------------------------------------------------------- 1 | global using NUnit.Framework; 2 | global using static Unity.Services.Cli.GameServerHosting.UnitTest.GameServerHostingUnitTestsConstants; 3 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Endpoints/CloudContentDeliveryEndpoints.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Common.Networking; 2 | 3 | namespace Unity.Services.Cli.GameServerHosting.Endpoints; 4 | 5 | public class CloudContentDeliveryEndpoints : NetworkTargetEndpoints 6 | { 7 | protected override string Prod { get; } = "https://content-api.cloud.unity3d.com/api/v1"; 8 | 9 | protected override string Staging { get; } = "https://content-api-stg.cloud.unity3d.com/api/v1"; 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Exceptions/DuplicateResourceException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using Unity.Services.Cli.Common.Exceptions; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.Exceptions; 5 | 6 | public class DuplicateResourceException : CliException 7 | { 8 | public DuplicateResourceException(string resource, string name) 9 | : base($"found duplicate {resource} of name {name}", Common.Exceptions.ExitCode.HandledError) 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Exceptions/InvalidConfigException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using Unity.Services.Cli.Common.Exceptions; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.Exceptions; 5 | 6 | public class InvalidConfigException : CliException 7 | { 8 | public InvalidConfigException(string path) 9 | : base($"Multiplay Hosting Config file is invalid. See output for details: {path}", Common.Exceptions.ExitCode.HandledError) { } 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Exceptions/InvalidExtensionException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using Unity.Services.Cli.Common.Exceptions; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.Exceptions; 5 | 6 | public class InvalidExtensionException : CliException 7 | { 8 | public InvalidExtensionException(string path, string extension) 9 | : base($"File path must end in '{extension}': {path}", Common.Exceptions.ExitCode.HandledError) { } 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Exceptions/InvalidIdsListException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using Unity.Services.Cli.Common.Exceptions; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.Exceptions; 5 | 6 | public class InvalidDateRangeException : CliException 7 | { 8 | public InvalidDateRangeException(string input) 9 | : base($"Invalid date range: '{input}'", Common.Exceptions.ExitCode.HandledError) { } 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Exceptions/InvalidKeyValuePairException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using Unity.Services.Cli.Common.Exceptions; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.Exceptions; 5 | 6 | public class InvalidKeyValuePairException : CliException 7 | { 8 | public InvalidKeyValuePairException(string input) 9 | : base($"Could not parse key:value pair from input: '{input}'", Common.Exceptions.ExitCode.HandledError) { } 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Exceptions/InvalidLegacyInputUsageException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using Unity.Services.Cli.Common.Exceptions; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.Exceptions; 5 | 6 | 7 | public class InvalidLegacyInputUsageException : CliException 8 | { 9 | public InvalidLegacyInputUsageException(string input) 10 | : base($"Build Configuration usage settings are invalid. Missing value for input: '{input}'", Common.Exceptions.ExitCode.HandledError) { } 11 | } 12 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Exceptions/InvalidResponseException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using Unity.Services.Cli.Common.Exceptions; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.Exceptions; 5 | 6 | public class InvalidResponseException : CliException 7 | { 8 | public InvalidResponseException(string reason) 9 | : base($"Response is invalid: '{reason}'", Common.Exceptions.ExitCode.HandledError) { } 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Exceptions/MissingInputException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using Unity.Services.Cli.Common.Exceptions; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.Exceptions; 5 | 6 | public class MissingInputException : CliException 7 | { 8 | public MissingInputException(string input) 9 | : base($"Missing value for input: '{input}'", Common.Exceptions.ExitCode.HandledError) { } 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Exceptions/PathNotFoundException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using Unity.Services.Cli.Common.Exceptions; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.Exceptions; 5 | 6 | public class PathNotFoundException : CliException 7 | { 8 | public PathNotFoundException(string path) 9 | : base($"File path {path} could not be found.", Common.Exceptions.ExitCode.HandledError) { } 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Exceptions/SyncFailedException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using Unity.Services.Cli.Common.Exceptions; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.Exceptions; 5 | 6 | public class SyncFailedException : CliException 7 | { 8 | public SyncFailedException() 9 | : base("failed to sync build", Common.Exceptions.ExitCode.HandledError) 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/GameServerHostingFeatures.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.GameServerHosting; 2 | 3 | static class GameServerHostingFeatures 4 | { 5 | public const string Root = "GameServerHosting"; 6 | public const string Build = "GameServerHostingBuild"; 7 | public const string Authoring = "GameServerHostingAuthoring"; 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Input/BuildConfigurationUpdateInput.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.Common.Input; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.Input; 5 | 6 | public class BuildConfigurationUpdateInput : BuildConfigurationCreateInput 7 | { 8 | public const string BuildConfigIdKey = "build-configuration-id"; 9 | 10 | public static readonly Argument BuildConfigIdArgument = new(BuildConfigIdKey, "The ID of the build configuration to update"); 11 | 12 | [InputBinding(nameof(BuildConfigIdArgument))] 13 | public long BuildConfigId { get; init; } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Input/BuildUpdateInput.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.Common.Input; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.Input; 5 | 6 | class BuildUpdateInput : BuildIdInput 7 | { 8 | public const string NameKey = "--name"; 9 | 10 | public static readonly Option BuildNameOption = new(NameKey, "The name of the build") 11 | { 12 | IsRequired = true 13 | }; 14 | 15 | [InputBinding(nameof(BuildNameOption))] 16 | public string? BuildName { get; init; } 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Model/BuildListOutput.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Gateway.GameServerHostingApiV1.Generated.Model; 2 | using YamlDotNet.Serialization; 3 | using YamlDotNet.Serialization.NamingConventions; 4 | 5 | namespace Unity.Services.Cli.GameServerHosting.Model; 6 | 7 | class BuildListOutput : List 8 | { 9 | public BuildListOutput(IReadOnlyCollection? builds) 10 | { 11 | if (builds != null) AddRange(builds.Select(b => new BuildOutput(b))); 12 | } 13 | 14 | public override string ToString() 15 | { 16 | var serializer = new SerializerBuilder() 17 | .WithNamingConvention(CamelCaseNamingConvention.Instance) 18 | .DisableAliases() 19 | .Build(); 20 | return serializer.Serialize(this); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Model/CoreDumpCredentialsOutput.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Gateway.GameServerHostingApiV1.Generated.Model; 2 | using YamlDotNet.Serialization; 3 | using YamlDotNet.Serialization.NamingConventions; 4 | 5 | namespace Unity.Services.Cli.GameServerHosting.Model; 6 | 7 | public class CoreDumpCredentialsOutput 8 | { 9 | public CoreDumpCredentialsOutput(CredentialsForTheBucket credentials) 10 | { 11 | StorageBucket = credentials.StorageBucket; 12 | } 13 | 14 | public string StorageBucket { get; set; } 15 | 16 | public override string ToString() 17 | { 18 | var serializer = new SerializerBuilder() 19 | .WithNamingConvention(CamelCaseNamingConvention.Instance) 20 | .Build(); 21 | return serializer.Serialize(this); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Model/FilesOutput.cs: -------------------------------------------------------------------------------- 1 | using File = Unity.Services.Gateway.GameServerHostingApiV1.Generated.Model.File; 2 | using YamlDotNet.Serialization; 3 | using YamlDotNet.Serialization.NamingConventions; 4 | 5 | namespace Unity.Services.Cli.GameServerHosting.Model; 6 | 7 | public class FilesOutput : List 8 | { 9 | public FilesOutput(IReadOnlyCollection? files) 10 | { 11 | if (files != null) AddRange(files.Select(f => new FilesItemOutput(f))); 12 | } 13 | 14 | public override string ToString() 15 | { 16 | var serializer = new SerializerBuilder() 17 | .WithNamingConvention(CamelCaseNamingConvention.Instance) 18 | .DisableAliases() 19 | .Build(); 20 | return serializer.Serialize(this); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Model/FleetListOutput.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Gateway.GameServerHostingApiV1.Generated.Model; 2 | using YamlDotNet.Serialization; 3 | using YamlDotNet.Serialization.NamingConventions; 4 | 5 | namespace Unity.Services.Cli.GameServerHosting.Model; 6 | 7 | class FleetListOutput : List 8 | { 9 | public FleetListOutput(IReadOnlyCollection? fleets) 10 | { 11 | if (fleets != null) AddRange(fleets.Select(f => new FleetListItemOutput(f))); 12 | } 13 | 14 | public override string ToString() 15 | { 16 | var serializer = new SerializerBuilder() 17 | .WithNamingConvention(CamelCaseNamingConvention.Instance) 18 | .DisableAliases() 19 | .Build(); 20 | return serializer.Serialize(this); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Model/GcsCredentials.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Unity.Services.Cli.GameServerHosting.Model; 4 | 5 | public class GcsCredentials 6 | { 7 | public GcsCredentials(string clientEmail, string privateKey) 8 | { 9 | ClientEmail = clientEmail; 10 | PrivateKey = privateKey; 11 | } 12 | 13 | [JsonProperty("client_email")] 14 | public string ClientEmail { get; set; } 15 | 16 | [JsonProperty("private_key")] 17 | public string PrivateKey { get; set; } 18 | } 19 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Model/InvalidGcsCredentialsFileFormat.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.GameServerHosting.Model; 2 | 3 | public class InvalidGcsCredentialsFileFormat 4 | { 5 | public override string ToString() 6 | { 7 | return $@"Invalid GCS credentials file format. Please check the file and try again. 8 | 9 | The file should be in the following format: 10 | {{ 11 | ... 12 | ""private_key"": ""..."", 13 | ""client_email"": ""..."", 14 | ... 15 | }} 16 | 17 | See: https://developers.google.com/workspace/guides/create-credentials#create_credentials_for_a_service_account 18 | "; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Model/LocalFile.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.GameServerHosting.Model; 2 | 3 | class LocalFile 4 | { 5 | readonly string m_PathInDirectory; 6 | readonly string m_SystemPath; 7 | 8 | public LocalFile(string systemPath, string pathInDirectory) 9 | { 10 | m_SystemPath = systemPath; 11 | m_PathInDirectory = pathInDirectory; 12 | } 13 | 14 | public string GetSystemPath() 15 | { 16 | return m_SystemPath; 17 | } 18 | 19 | public string GetPathInDirectory() 20 | { 21 | return m_PathInDirectory; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Model/ServersOutput.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Gateway.GameServerHostingApiV1.Generated.Model; 2 | using YamlDotNet.Serialization; 3 | using YamlDotNet.Serialization.NamingConventions; 4 | 5 | namespace Unity.Services.Cli.GameServerHosting.Model; 6 | 7 | class ServersOutput : List 8 | { 9 | public ServersOutput(IReadOnlyCollection? servers) 10 | { 11 | if (servers != null) AddRange(servers.Select(s => new ServersItemOutput(s))); 12 | } 13 | 14 | public override string ToString() 15 | { 16 | var serializer = new SerializerBuilder() 17 | .WithNamingConvention(CamelCaseNamingConvention.Instance) 18 | .DisableAliases() 19 | .Build(); 20 | return serializer.Serialize(this); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Service/IGameServerHostingService.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Gateway.GameServerHostingApiV1.Generated.Api; 2 | 3 | namespace Unity.Services.Cli.GameServerHosting.Service; 4 | 5 | public interface IGameServerHostingService 6 | { 7 | public IBuildsApi BuildsApi { get; } 8 | public IBuildConfigurationsApi BuildConfigurationsApi { get; } 9 | public IFilesApi FilesApi { get; } 10 | public IFleetsApi FleetsApi { get; } 11 | public IMachinesApi MachinesApi { get; } 12 | public IServersApi ServersApi { get; } 13 | public ICoreDumpApi CoreDumpApi { get; } 14 | 15 | public Task AuthorizeGameServerHostingService(CancellationToken cancellationToken = default); 16 | } 17 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Services/DummyBinaryBuilder.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Multiplay.Authoring.Core; 2 | using Unity.Services.Multiplay.Authoring.Core.Builds; 3 | 4 | namespace Unity.Services.Cli.GameServerHosting.Services; 5 | 6 | class DummyBinaryBuilder : IBinaryBuilder 7 | { 8 | public ServerBuild BuildLinuxServer(string outDir, string executable) 9 | { 10 | return new ServerBuild(Path.Combine(outDir, executable)); 11 | } 12 | 13 | public void WarnBuildTargetChanged() { } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Services/GameServerHostingApiConfig.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.GameServerHosting.Services; 2 | 3 | public class GameServerHostingApiConfig 4 | { 5 | public Guid ProjectId { get; set; } 6 | public Guid EnvironmentId { get; set; } 7 | public string? CcdApiKey { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Services/IDeployFileService.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.GameServerHosting.Services; 2 | 3 | interface IDeployFileService 4 | { 5 | public IEnumerable ListFilesToDeploy(ICollection paths, string extension); 6 | public Task ReadAllTextAsync(string path, CancellationToken cancellationToken); 7 | } 8 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.GameServerHosting/Services/IGameServerHostingConfigLoader.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Multiplay.Authoring.Core.Assets; 2 | 3 | namespace Unity.Services.Cli.GameServerHosting.Services; 4 | 5 | interface IGameServerHostingConfigLoader 6 | { 7 | Task LoadAndValidateAsync(ICollection paths, CancellationToken cancellationToken); 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Integration.MockServer/IServiceApiMock.cs: -------------------------------------------------------------------------------- 1 | using WireMock.Admin.Mappings; 2 | using WireMock.Server; 3 | 4 | namespace Unity.Services.Cli.MockServer; 5 | 6 | public interface IServiceApiMock 7 | { 8 | /// 9 | /// Create mapping modules for a service 10 | /// 11 | /// models to be used by MockApi 12 | public Task> CreateMappingModels(); 13 | 14 | 15 | /// 16 | /// custom behaviour to mock service api for mock server 17 | /// 18 | /// 19 | void CustomMock(WireMockServer mockServer); 20 | } 21 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Integration.MockServer/ServiceMocks/RemoteConfig/Config.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.MockServer.ServiceMocks.RemoteConfig; 2 | 3 | [Serializable] 4 | class Config 5 | { 6 | public string? ProjectId { get; set; } 7 | public string? EnvironmentId { get; set; } 8 | public string? Type { get; set; } 9 | public string? Id { get; set; } 10 | public string? Version { get; set; } 11 | public string? CreatedAt { get; set; } 12 | public string? UpdatedAt { get; set; } 13 | public List? Value { get; set; } 14 | } 15 | 16 | 17 | [Serializable] 18 | public struct RemoteConfigEntry 19 | { 20 | public string key; 21 | public object value; 22 | public string type; 23 | } 24 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Integration.MockServer/ServiceMocks/RemoteConfig/ConfigValue.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.MockServer.ServiceMocks.RemoteConfig; 2 | 3 | [Serializable] 4 | public struct ConfigValue 5 | { 6 | public readonly string Key; 7 | public readonly ValueType Type; 8 | public readonly object Value; 9 | 10 | public ConfigValue(string key, ValueType type, object value) 11 | { 12 | Key = key; 13 | Type = type; 14 | Value = value; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Integration.MockServer/ServiceMocks/RemoteConfig/GetResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.MockServer.ServiceMocks.RemoteConfig; 2 | 3 | [Serializable] 4 | class GetResponse 5 | { 6 | public List? Configs { get; set; } 7 | } 8 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Integration.MockServer/ServiceMocks/RemoteConfig/ValueType.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.MockServer.ServiceMocks.RemoteConfig; 2 | 3 | public enum ValueType 4 | { 5 | String, 6 | Int, 7 | Bool, 8 | Float, 9 | Long, 10 | Json, 11 | } 12 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Integration.MockServerApp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "Unity.Services.Cli.MockServerApp": { 5 | "commandName": "Project", 6 | "commandLineArgs": "" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Integration.MockServerApp/Unity.Services.Cli.Integration.MockServerApp.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Exe 4 | net8.0 5 | enable 6 | enable 7 | true 8 | 9 | true 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/AccessTests/Data/policy.json: -------------------------------------------------------------------------------- 1 | { 2 | "statements": [ 3 | { 4 | "Sid": "DenyAccessForCloudCode", 5 | "Action": ["Read"], 6 | "Resource": "urn:ugs:cloud-code:/*", 7 | "Effect": "Deny", 8 | "Principal": "Player" 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/AccessTests/Data/statements.json: -------------------------------------------------------------------------------- 1 | { 2 | "statementIDs": ["statement-id-to-be-deleted"] 3 | } 4 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/Common/UgsCliTestCase.IProcess.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.IO; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | 6 | namespace Unity.Services.Cli.IntegrationTest.Common; 7 | 8 | public partial class UgsCliTestCase 9 | { 10 | interface IProcess 11 | { 12 | bool HasExited { get; } 13 | Task WaitForExitAsync(CancellationToken cancellationToken = default); 14 | StreamWriter StandardInput { get; } 15 | public StreamReader StandardOutput { get; } 16 | public StreamReader StandardError { get; } 17 | int ExitCode { get; } 18 | ProcessStartInfo StartInfo { get; } 19 | bool Start(); 20 | void Dispose(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/EconomyTests/Resources/invalidCurrencyDefinition_BadValueType.ecc: -------------------------------------------------------------------------------- 1 | { 2 | "id": "GOLD", 3 | "name": "Gold", 4 | "type": "CURRENCY", 5 | "initial": 10, 6 | "max": "abc", 7 | "customData": null 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/EconomyTests/Resources/invalidCurrencyDefinition_MissingField.ecc: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Gold", 3 | "type": "CURRENCY", 4 | "initial": 10, 5 | "max": 1000, 6 | "customData": null 7 | } 8 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/EconomyTests/Resources/invalidCurrencyDefinition_NegativeInitialAmount.ecc: -------------------------------------------------------------------------------- 1 | { 2 | "id": "GOLD", 3 | "name": "Gold", 4 | "type": "CURRENCY", 5 | "initial": -10, 6 | "max": 90000, 7 | "customData": null 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/EconomyTests/Resources/invalidInventoryDefinition_MissingField.eci: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Sword", 3 | "type": "INVENTORY_ITEM", 4 | "customData": null 5 | } 6 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/EconomyTests/Resources/invalidResourceDefinition_BadType.ecc: -------------------------------------------------------------------------------- 1 | { 2 | "id": "GOLD", 3 | "name": "Gold", 4 | "type": "SOME_FAKE_TYPE", 5 | "initial": 10, 6 | "max": 1000, 7 | "customData": null 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/EconomyTests/Resources/validCurrencyDefinition.ecc: -------------------------------------------------------------------------------- 1 | { 2 | "id": "GOLD", 3 | "name": "Gold", 4 | "type": "CURRENCY", 5 | "initial": 10, 6 | "max": 1000, 7 | "customData": null 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/EconomyTests/Resources/validInventoryDefinition.eci: -------------------------------------------------------------------------------- 1 | { 2 | "id": "SWORD", 3 | "name": "Sword", 4 | "type": "INVENTORY_ITEM", 5 | "customData": null 6 | } 7 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/EconomyTests/Resources/validRealMoneyPurchaseDefinition.ecr: -------------------------------------------------------------------------------- 1 | { 2 | "id": "BUY_GOLD", 3 | "name": "Buy Gold", 4 | "type": "MONEY_PURCHASE", 5 | "customData": null, 6 | "rewards": [ 7 | { 8 | "resourceId": "GOLD", 9 | "amount": 100 10 | } 11 | ], 12 | "storeIdentifiers": { 13 | "appleAppStore": "test-apple", 14 | "googlePlayStore": "test-google" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/EconomyTests/Resources/validVirtualPurchaseDefinition.ecv: -------------------------------------------------------------------------------- 1 | { 2 | "id": "BUY_SWORD", 3 | "name": "Buy Sword", 4 | "type": "VIRTUAL_PURCHASE", 5 | "customData": null, 6 | "costs": [ 7 | { 8 | "resourceId": "GOLD", 9 | "amount": 5 10 | } 11 | ], 12 | "rewards": [ 13 | { 14 | "resourceId": "SWORD", 15 | "amount": 1 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.IntegrationTest/EconomyTests/Resources/validVirtualPurchaseDefinition_FreeGift.ecv: -------------------------------------------------------------------------------- 1 | { 2 | "id": "BUY_SWORD", 3 | "name": "Buy Sword", 4 | "type": "VIRTUAL_PURCHASE", 5 | "customData": null, 6 | "costs": [ 7 | ], 8 | "rewards": [ 9 | { 10 | "resourceId": "SWORD", 11 | "amount": 1 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Leaderboards.UnitTest/Utils/TestValues.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Leaderboards.UnitTest.Utils; 2 | 3 | public class TestValues 4 | { 5 | public const string ValidProjectId = "a912b1fd-541d-42e1-89f2-85436f27aabd"; 6 | public const string ValidEnvironmentId = "00000000-0000-0000-0000-000000000000"; 7 | public const string Cursor = "leaderboard_id_1"; 8 | public const int Limit = 10; 9 | } 10 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Leaderboards/Deploy/ILeaderboardsConfigLoader.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Leaderboards.Authoring.Core.Model; 2 | 3 | namespace Unity.Services.Cli.Leaderboards.Deploy; 4 | 5 | interface ILeaderboardsConfigLoader 6 | { 7 | Task<(IReadOnlyList Loaded,IReadOnlyList Failed)> LoadConfigsAsync( 8 | IReadOnlyCollection paths, 9 | CancellationToken cancellationToken); 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Leaderboards/Handlers/ImportExport/ImportExportUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json; 2 | using Unity.Services.Cli.Common.Input; 3 | using Unity.Services.Cli.Common.Utils; 4 | using Unity.Services.Gateway.LeaderboardApiV1.Generated.Model; 5 | 6 | namespace Unity.Services.Cli.Leaderboards.Handlers.ImportExport; 7 | 8 | static class ImportExportUtils 9 | { 10 | public static string ToRequestBody(this UpdatedLeaderboardConfig config) 11 | { 12 | return JsonSerializer.Serialize(config); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Leaderboards/Handlers/ImportExport/LeaderboardsConstants.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Common.Telemetry; 2 | 3 | namespace Unity.Services.Cli.Leaderboards.Handlers.ImportExport; 4 | 5 | static class LeaderboardConstants 6 | { 7 | internal const string ZipName = "ugs.lbzip"; 8 | internal const string EntryName = "leaderboards"; 9 | } 10 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Leaderboards/Handlers/RequestBodyHandler.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Common.Exceptions; 2 | 3 | namespace Unity.Services.Cli.Leaderboards.Handlers; 4 | 5 | class RequestBodyHandler 6 | { 7 | public static async Task GetRequestBodyAsync(string? input) 8 | { 9 | if (File.Exists(input)) 10 | { 11 | return await File.ReadAllTextAsync(input); 12 | } 13 | 14 | throw new CliException("Invalid file path.", ExitCode.HandledError); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Leaderboards/IO/FileSystem.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Leaderboards.Authoring.Core.IO; 2 | 3 | namespace Unity.Services.Cli.Leaderboards.IO; 4 | 5 | class FileSystem : Common.IO.FileSystem, IFileSystem { } 6 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Leaderboards/Input/CreateInput.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.Common.Input; 3 | 4 | namespace Unity.Services.Cli.Leaderboards.Input; 5 | 6 | class CreateInput : LeaderboardIdInput 7 | { 8 | const string k_JsonBodyDescription = 9 | "Json file path of the leadeboard config, \n" + 10 | "Payload example: https://services.docs.unity.com/leaderboards-admin/v1/#tag/Leaderboards/operation/createLeaderboard"; 11 | 12 | public static readonly Argument RequestBodyArgument = new("file-path", k_JsonBodyDescription); 13 | 14 | [InputBinding(nameof(RequestBodyArgument))] 15 | public string? JsonFilePath { get; set; } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Leaderboards/Input/LeaderboardIdInput.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.Common.Input; 3 | 4 | namespace Unity.Services.Cli.Leaderboards.Input; 5 | 6 | class LeaderboardIdInput : CommonInput 7 | { 8 | const string k_JsonLeaderboardIdDescription = "leaderboard id to fetch or update"; 9 | 10 | public static readonly Argument RequestLeaderboardIdArgument = new("leaderboard-id", k_JsonLeaderboardIdDescription); 11 | 12 | [InputBinding(nameof(RequestLeaderboardIdArgument))] 13 | public string? LeaderboardId { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Leaderboards/Input/ListLeaderboardInput.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.Common.Input; 3 | 4 | namespace Unity.Services.Cli.Leaderboards.Input; 5 | 6 | class ListLeaderboardInput : CommonInput 7 | { 8 | public static readonly Option CursorOption = new Option("--cursor", "The ID of the leaderboard that listing should start after, i.e. the last leaderboard returned from the previous page when paging"); 9 | [InputBinding(nameof(CursorOption))] 10 | public string? Cursor { get; set; } 11 | 12 | public static readonly Option LimitOption = new Option("--limit", "The number of leaderboards to return. Defaults to 10"); 13 | [InputBinding(nameof(LimitOption))] 14 | public int? Limit { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Leaderboards/Input/ResetInput.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.Common.Input; 3 | 4 | namespace Unity.Services.Cli.Leaderboards.Input; 5 | 6 | class ResetInput : LeaderboardIdInput 7 | { 8 | const string k_ArchiveDescription = 9 | "Whether or not to archive the current set of scores before resetting the leaderboard. "; 10 | public static readonly Option ResetArchiveArgument = new(new[] 11 | { 12 | "-a", 13 | "--archive" 14 | }, k_ArchiveDescription); 15 | 16 | [InputBinding(nameof(ResetArchiveArgument))] 17 | public bool? Archive { get; set; } 18 | } 19 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Leaderboards/Input/UpdateInput.cs: -------------------------------------------------------------------------------- 1 | using System.CommandLine; 2 | using Unity.Services.Cli.Common.Input; 3 | 4 | namespace Unity.Services.Cli.Leaderboards.Input; 5 | 6 | class UpdateInput : LeaderboardIdInput 7 | { 8 | const string k_JsonBodyDescription = 9 | "Json file path of the leadeboard config \n" + 10 | "Payload example: https://services.docs.unity.com/leaderboards-admin/v1/#tag/Leaderboards/operation/updateLeaderboardConfig"; 11 | 12 | public static readonly Argument RequestBodyArgument = new("file-path", k_JsonBodyDescription); 13 | 14 | [InputBinding(nameof(RequestBodyArgument))] 15 | public string? JsonFilePath { get; set; } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/Config/ConfigSchema.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using Unity.Services.Cli.Authoring.Templates; 3 | using Unity.Services.Cli.Common.Utils; 4 | 5 | namespace Unity.Services.Cli.Lobby.Handlers.Config; 6 | 7 | public class ConfigSchema : IFileTemplate 8 | { 9 | const string k_EmbeddedConfigSchema = "Unity.Services.Cli.Lobby.Handlers.Config.lobby-config-schema.json"; 10 | 11 | public string Extension => ".json"; 12 | 13 | public string FileBodyText => ResourceFileHelper 14 | .ReadResourceFileAsync(Assembly.GetExecutingAssembly(), k_EmbeddedConfigSchema).Result; 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/Config/ConfigSchemaV2.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using Unity.Services.Cli.Authoring.Templates; 3 | using Unity.Services.Cli.Common.Utils; 4 | 5 | namespace Unity.Services.Cli.Lobby.Handlers.Config; 6 | 7 | public class ConfigSchemaV2 : IFileTemplate 8 | { 9 | const string k_EmbeddedConfigSchema = "Unity.Services.Cli.Lobby.Handlers.Config.lobby-config-schema-v2.json"; 10 | 11 | public string Extension => ".json"; 12 | 13 | public string FileBodyText => ResourceFileHelper 14 | .ReadResourceFileAsync(Assembly.GetExecutingAssembly(), k_EmbeddedConfigSchema).Result; 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/ImportExport/ImportHandler.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Common.Console; 2 | using Unity.Services.Cli.Authoring.Import.Input; 3 | 4 | namespace Unity.Services.Cli.Lobby.Handlers.ImportExport; 5 | 6 | static class ImportHandler 7 | { 8 | internal const string LoadingIndicatorMessage = "Importing configs..."; 9 | 10 | public static async Task ImportAsync( 11 | ImportInput importInput, 12 | LobbyImporter? lobbyImporter, 13 | ILoadingIndicator loadingIndicator, 14 | CancellationToken cancellationToken 15 | ) 16 | { 17 | await loadingIndicator.StartLoadingAsync( 18 | LoadingIndicatorMessage, 19 | _ => lobbyImporter!.ImportAsync(importInput, cancellationToken)); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Lobby/Handlers/LobbyConstants.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Lobby.Handlers; 2 | 3 | static class LobbyConstants 4 | { 5 | internal const string ConfigType = "lobby"; 6 | 7 | internal const string SchemaId = "lobby"; 8 | 9 | internal const string SchemaIdV2 = "lobbyv2"; 10 | 11 | internal const string ConfigKey = "lobbyConfig"; 12 | 13 | internal const string ZipName = "ugs.lozip"; 14 | 15 | internal const string EntryName = "lobby"; 16 | 17 | internal const string ConfigDisplayName = "Lobby configuration"; 18 | } 19 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Matchmaker.UnitTest/SampleConfigs/TestEmptyQueueConfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ugs-config-schemas.unity3d.com/v1/matchmaker/matchmaker-queue.schema.json", 3 | "name": "EmptyQueue", 4 | "enabled": true, 5 | "maxPlayersPerTicket": 2, 6 | "filteredPools": [] 7 | } 8 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Matchmaker.UnitTest/SampleConfigs/TestEnvironmentConfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ugs-config-schemas.unity3d.com/v1/matchmaker/matchmaker-environment-config.schema.json", 3 | "enabled": true, 4 | "defaultQueueName": "DefaultQueueTest" 5 | } 6 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Matchmaker/Parser/ResourceNameConverter.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Unity.Services.Matchmaker.Authoring.Core.Model; 3 | 4 | namespace Unity.Services.Cli.Matchmaker.Parser; 5 | 6 | public class ResourceNameConverter : JsonConverter 7 | { 8 | public override bool CanConvert(Type objectType) 9 | { 10 | return objectType.IsSubclassOf(typeof(ResourceName)); 11 | } 12 | 13 | public override object ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) 14 | { 15 | return Activator.CreateInstance(objectType, reader.Value) ?? throw new InvalidOperationException(); 16 | } 17 | 18 | public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer) 19 | { 20 | writer.WriteValue(value?.ToString()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Matchmaker/Service/AdminApiTargetEndpoint.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Common.Networking; 2 | 3 | namespace Unity.Services.Cli.Matchmaker.Service; 4 | 5 | public class AdminApiTargetEndpoint : NetworkTargetEndpoints 6 | { 7 | 8 | public AdminApiTargetEndpoint() { } 9 | 10 | protected override string Prod { get; } = "https://services.api.unity.com/"; 11 | 12 | protected override string Staging { get; } = "https://staging.services.api.unity.com/"; 13 | } 14 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Player/Models/PlayerListResponseResult.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Linq; 3 | using Unity.Services.Gateway.PlayerAdminApiV3.Generated.Model; 4 | 5 | namespace Unity.Services.Cli.Player.Model; 6 | 7 | public class PlayerListResponseResult 8 | { 9 | public PlayerAuthListProjectUserResponse Players; 10 | 11 | public PlayerListResponseResult(PlayerAuthListProjectUserResponse players) 12 | { 13 | Players = players; 14 | } 15 | 16 | public override string ToString() 17 | { 18 | var jsonString = JsonConvert.SerializeObject(Players); 19 | var formattedJson = JToken.Parse(jsonString).ToString(Formatting.Indented); 20 | return formattedJson; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Player/Networking/Endpoints/PlayerAdminEndpoints.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Common.Networking; 2 | 3 | namespace Unity.Services.Cli.Player.Networking; 4 | 5 | public class PlayerAdminEndpoints : NetworkTargetEndpoints 6 | { 7 | protected override string Prod { get; } = "https://services.api.unity.com"; 8 | 9 | protected override string Staging { get; } = "https://staging.services.api.unity.com"; 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Player/Networking/Endpoints/PlayerAuthEndpoints.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Common.Networking; 2 | 3 | namespace Unity.Services.Cli.Player.Networking; 4 | 5 | public class PlayerAuthEndpoints : NetworkTargetEndpoints 6 | { 7 | protected override string Prod { get; } = "https://player-auth.services.api.unity.com"; 8 | 9 | protected override string Staging { get; } = "https://player-auth-stg.services.api.unity.com"; 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.RemoteConfig/Deploy/FileSystem.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.RemoteConfig.Editor.Authoring.Core.IO; 2 | 3 | namespace Unity.Services.Cli.RemoteConfig.Deploy; 4 | 5 | class FileSystem : Common.IO.FileSystem, IFileSystem 6 | { 7 | public Task Delete(string path) 8 | { 9 | return base.Delete(path, CancellationToken.None); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.RemoteConfig/Deploy/ICliRemoteConfigClient.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.RemoteConfig.Editor.Authoring.Core.Service; 2 | 3 | namespace Unity.Services.Cli.RemoteConfig.Deploy; 4 | 5 | interface ICliRemoteConfigClient : IRemoteConfigClient 6 | { 7 | void Initialize(string projectId, string environmentId, CancellationToken cancellationToken); 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.RemoteConfig/Deploy/IRemoteConfigScriptsLoader.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Authoring.Model; 2 | using Unity.Services.Cli.RemoteConfig.Deploy; 3 | 4 | namespace Unity.Services.Cli.RemoteConfig.Deploy; 5 | 6 | interface IRemoteConfigScriptsLoader 7 | { 8 | Task LoadScriptsAsync( 9 | IReadOnlyList filePaths, 10 | CancellationToken token); 11 | } 12 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.RemoteConfig/Deploy/IllegalEntryDetector.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.RemoteConfig.Editor.Authoring.Core.ErrorHandling; 2 | using Unity.Services.RemoteConfig.Editor.Authoring.Core.Formatting; 3 | using Unity.Services.RemoteConfig.Editor.Authoring.Core.Model; 4 | 5 | namespace Unity.Services.Cli.RemoteConfig.Deploy; 6 | 7 | class IllegalEntryDetector : IIllegalEntryDetector 8 | { 9 | public bool ContainsIllegalEntries(IRemoteConfigFile remoteConfigFile, ICollection deploymentExceptions) 10 | { 11 | return false; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.RemoteConfig/Deploy/LoadResult.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Authoring.Model; 2 | using Unity.Services.RemoteConfig.Editor.Authoring.Core.Model; 3 | 4 | namespace Unity.Services.Cli.RemoteConfig.Deploy; 5 | 6 | class LoadResult 7 | { 8 | public IReadOnlyList Loaded { get; } 9 | public IReadOnlyList Failed { get; } 10 | 11 | public LoadResult(IReadOnlyList loaded, IReadOnlyList failed) 12 | { 13 | Loaded = loaded; 14 | Failed = failed; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.RemoteConfig/Deploy/RemoteConfigFile.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Authoring.Model; 2 | using Unity.Services.DeploymentApi.Editor; 3 | using Unity.Services.RemoteConfig.Editor.Authoring.Core.Model; 4 | 5 | namespace Unity.Services.Cli.RemoteConfig.Deploy; 6 | 7 | class RemoteConfigFile : DeployContent, IRemoteConfigFile 8 | { 9 | public RemoteConfigFile(string name, string path) 10 | : base(name, "RemoteConfig File", path, 0f, DeploymentStatus.Empty ) 11 | { 12 | Entries = new List(); 13 | } 14 | public List Entries { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.RemoteConfig/Exceptions/ApiException.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using Unity.Services.Cli.Common.Exceptions; 3 | 4 | namespace Unity.Services.Cli.RemoteConfig.Exceptions; 5 | 6 | public class ApiException : CliException 7 | { 8 | public ApiException(string message, Exception? innerException, int exitCode) 9 | : base(message, innerException, exitCode) { } 10 | 11 | public ApiException(string message, int exitCode) 12 | : base(message, exitCode) { } 13 | 14 | public ApiException(int exitCode) 15 | : base(exitCode) { } 16 | } 17 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.RemoteConfig/Exceptions/ConfigTypeException.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Common.Exceptions; 2 | 3 | namespace Unity.Services.Cli.RemoteConfig.Exceptions; 4 | 5 | public class ConfigTypeException : CliException 6 | { 7 | public ConfigTypeException(string message, int exitCode) 8 | : base(message, exitCode) { } 9 | } 10 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.RemoteConfig/Handlers/ExportImport/RemoteConfigConstants.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Unity.Services.Cli.RemoteConfig.Handlers.ExportImport; 3 | 4 | static class RemoteConfigConstants 5 | { 6 | internal const string ZipName = "ugs.rczip"; 7 | internal static readonly string EntryName = "rc-config"; 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.RemoteConfig/Model/CliRemoteConfigEntry.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Authoring.Model; 2 | using Unity.Services.DeploymentApi.Editor; 3 | 4 | namespace Unity.Services.Cli.RemoteConfig.Model; 5 | 6 | 7 | public class CliRemoteConfigEntry : DeployContent 8 | { 9 | public CliRemoteConfigEntry(string name, string type, string path, float progress, string status, string? detail = null, SeverityLevel level = SeverityLevel.None) 10 | : base(name, type, path, progress, status, detail, level) 11 | { } 12 | 13 | public override string ToString() 14 | { 15 | return $"Key '{Name}' in '{Path}'"; 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.RemoteConfig/Model/Config.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.RemoteConfig.Editor.Authoring.Core.Model; 2 | 3 | namespace Unity.Services.Cli.RemoteConfig.Model; 4 | 5 | [Serializable] 6 | class Config 7 | { 8 | public string? ProjectId { get; set; } 9 | public string? EnvironmentId { get; set; } 10 | public string? Type { get; set; } 11 | public string? Id { get; set; } 12 | public string? Version { get; set; } 13 | public string? CreatedAt { get; set; } 14 | public string? UpdatedAt { get; set; } 15 | public List? Value { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.RemoteConfig/Model/CreateResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.RemoteConfig.Model; 2 | 3 | [Serializable] 4 | class CreateResponse 5 | { 6 | public string? Id { get; set; } 7 | public string? CreatedAt { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.RemoteConfig/Model/GetResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.RemoteConfig.Model; 2 | 3 | [Serializable] 4 | class GetResponse 5 | { 6 | public List? Configs { get; set; } 7 | } 8 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.RemoteConfig/Model/UpdateConfigRequest.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.RemoteConfig.Model; 2 | 3 | [Serializable] 4 | public class UpdateConfigRequest 5 | { 6 | public string? Type { get; set; } 7 | public IEnumerable? Value { get; set; } 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.RemoteConfig/Service/IRemoteConfigServicesWrapper.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Authoring.Service; 2 | using Unity.Services.Cli.RemoteConfig.Deploy; 3 | using Unity.Services.RemoteConfig.Editor.Authoring.Core.Deployment; 4 | 5 | namespace Unity.Services.Cli.RemoteConfig.Service; 6 | 7 | interface IRemoteConfigServicesWrapper 8 | { 9 | IRemoteConfigDeploymentHandler DeploymentHandler { get; } 10 | 11 | ICliRemoteConfigClient RemoteConfigClient { get; } 12 | 13 | IRemoteConfigScriptsLoader RemoteConfigScriptsLoader { get; } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.RemoteConfig/Types/Config.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.RemoteConfig.Types; 2 | 3 | public enum ValueType 4 | { 5 | String, 6 | Int, 7 | Bool, 8 | Float, 9 | Long, 10 | Json, 11 | } 12 | 13 | public struct ConfigValue 14 | { 15 | public readonly string Key; 16 | public readonly ValueType Type; 17 | public readonly object Value; 18 | 19 | public ConfigValue(string key, ValueType type, object value) 20 | { 21 | Key = key; 22 | Type = type; 23 | Value = value; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Scheduler.UnitTest/Usings.cs: -------------------------------------------------------------------------------- 1 | global using NUnit.Framework; 2 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Scheduler.UnitTest/Utils/TestValues.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Scheduler.UnitTest.Utils; 2 | 3 | public class TestValues 4 | { 5 | public const string ValidProjectId = "a912b1fd-541d-42e1-89f2-85436f27aabd"; 6 | public const string ValidEnvironmentId = "00000000-0000-0000-0000-000000000000"; 7 | public const string Cursor = "schedule_id_1"; 8 | public const int Limit = 10; 9 | } 10 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Scheduler/Deploy/IScheduleResourceLoader.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Scheduler.Deploy; 2 | 3 | interface IScheduleResourceLoader 4 | { 5 | Task LoadResource(string filePath, CancellationToken cancellationToken); 6 | } 7 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Scheduler/Deploy/ScheduleFileItem.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using Unity.Services.Cli.Authoring.Model; 3 | using Unity.Services.DeploymentApi.Editor; 4 | 5 | namespace Unity.Services.Cli.Scheduler.Deploy; 6 | 7 | [DataContract] 8 | public class ScheduleFileItem : DeployContent 9 | { 10 | public ScheduleConfigFile Content { get; } 11 | const string k_TriggersConfigFileType = "Schedule Config File"; 12 | 13 | public ScheduleFileItem(ScheduleConfigFile content, string path, float progress = 0, DeploymentStatus? status = null) 14 | : base( 15 | System.IO.Path.GetFileName(path), 16 | k_TriggersConfigFileType, 17 | path, 18 | progress, 19 | status) 20 | { 21 | Content = content; 22 | Path = path; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Scheduler/Deploy/ScheduleSerializer.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Unity.Services.Scheduler.Authoring.Core.Model; 3 | using Unity.Services.Scheduler.Authoring.Core.Serialization; 4 | 5 | namespace Unity.Services.Cli.Scheduler.Deploy; 6 | 7 | public class SchedulesSerializer : ISchedulesSerializer 8 | { 9 | public string Serialize(IList config) 10 | { 11 | var file = new ScheduleConfigFile() 12 | { 13 | Configs = config.Cast().ToDictionary(k => k.Name, v => v) 14 | }; 15 | return JsonConvert.SerializeObject(file, Formatting.Indented); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Scheduler/IO/FileSystem.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Scheduler.Authoring.Core.IO; 2 | 3 | namespace Unity.Services.Cli.Scheduler.IO; 4 | 5 | class FileSystem : Common.IO.FileSystem, IFileSystem { } 6 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Scheduler/SchedulerConstants.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Scheduler; 2 | 3 | public static class SchedulerConstants 4 | { 5 | public static string DeployFileExtension => ".sched"; 6 | public static string ServiceType => "Scheduler"; 7 | public static string ServiceName => "scheduler"; 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.ServiceAccountAuthentication.UnitTest/Mock/MemoryTokenPersister.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Common.Persister; 2 | 3 | namespace Unity.Services.Cli.Authentication.UnitTest; 4 | 5 | class MemoryTokenPersister : IPersister 6 | { 7 | public string? PersistedToken { get; set; } 8 | 9 | public Task LoadAsync(CancellationToken cancellationToken = default) 10 | => Task.FromResult(PersistedToken); 11 | 12 | public Task SaveAsync(string data, CancellationToken cancellationToken = default) 13 | { 14 | PersistedToken = data; 15 | return Task.CompletedTask; 16 | } 17 | 18 | public Task DeleteAsync(CancellationToken cancellationToken = default) 19 | { 20 | PersistedToken = null; 21 | return Task.CompletedTask; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.ServiceAccountAuthentication.UnitTest/Utils/ConsoleInputOverrideScope.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Authentication.UnitTest; 2 | 3 | struct ConsoleInputOverrideScope : IDisposable 4 | { 5 | public TextReader PreviousInput { get; } = Console.In; 6 | 7 | public TextReader OverrideInput { get; } 8 | 9 | bool m_IsDisposed; 10 | 11 | public ConsoleInputOverrideScope(TextReader input) 12 | { 13 | PreviousInput = Console.In; 14 | OverrideInput = input; 15 | m_IsDisposed = false; 16 | 17 | Console.SetIn(OverrideInput); 18 | } 19 | 20 | public void Dispose() 21 | { 22 | if (m_IsDisposed) 23 | return; 24 | 25 | Console.SetIn(PreviousInput); 26 | m_IsDisposed = true; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.ServiceAccountAuthentication/Authenticator/IAuthenticator.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Common.SystemEnvironment; 2 | using Unity.Services.Cli.ServiceAccountAuthentication.Input; 3 | 4 | namespace Unity.Services.Cli.ServiceAccountAuthentication; 5 | 6 | interface IAuthenticator 7 | { 8 | Task LoginAsync(LoginInput input, CancellationToken cancellationToken = default); 9 | 10 | Task LogoutAsync(ISystemEnvironmentProvider environmentProvider, 11 | CancellationToken cancellationToken = default); 12 | 13 | Task GetTokenAsync(CancellationToken cancellationToken = default); 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.ServiceAccountAuthentication/Authenticator/Response/LogoutResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.ServiceAccountAuthentication; 2 | 3 | /// 4 | /// This is the response format for LogoutAsync 5 | /// 6 | public class LogoutResponse 7 | { 8 | public string Information { get; } 9 | public string? Warning { get; } 10 | 11 | public LogoutResponse(string information, string? warning) 12 | { 13 | Information = information; 14 | Warning = warning; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.ServiceAccountAuthentication/Exceptions/InvalidLoginInputException.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Common.Exceptions; 2 | 3 | namespace Unity.Services.Cli.ServiceAccountAuthentication.Exceptions; 4 | 5 | public class InvalidLoginInputException : CliException 6 | { 7 | public InvalidLoginInputException(int exitCode = Common.Exceptions.ExitCode.HandledError) 8 | : base(exitCode) { } 9 | 10 | public InvalidLoginInputException(string message, int exitCode = Common.Exceptions.ExitCode.HandledError) 11 | : base(message, exitCode) { } 12 | 13 | public InvalidLoginInputException(string message, Exception innerException, int exitCode = Common.Exceptions.ExitCode.HandledError) 14 | : base(message, innerException, exitCode) { } 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.ServiceAccountAuthentication/Exceptions/MissingAccessTokenException.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Common.Exceptions; 2 | 3 | namespace Unity.Services.Cli.ServiceAccountAuthentication.Exceptions; 4 | 5 | public class MissingAccessTokenException : CliException 6 | { 7 | public MissingAccessTokenException(int exitCode = Common.Exceptions.ExitCode.HandledError) 8 | : base(exitCode) { } 9 | 10 | public MissingAccessTokenException(string message, int exitCode = Common.Exceptions.ExitCode.HandledError) 11 | : base(message, exitCode) { } 12 | 13 | public MissingAccessTokenException(string message, Exception innerException, int exitCode = Common.Exceptions.ExitCode.HandledError) 14 | : base(message, innerException, exitCode) { } 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.ServiceAccountAuthentication/Handlers/LoginHandler.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using Unity.Services.Cli.ServiceAccountAuthentication.Input; 3 | 4 | namespace Unity.Services.Cli.ServiceAccountAuthentication.Handlers; 5 | 6 | static class LoginHandler 7 | { 8 | public static async Task LoginAsync( 9 | LoginInput input, IAuthenticator authenticator, ILogger logger, CancellationToken cancellationToken) 10 | { 11 | await authenticator.LoginAsync(input, cancellationToken); 12 | logger.LogInformation("Service Account key saved in local configuration."); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.ServiceAccountAuthentication/Handlers/LogoutHandler.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | using Unity.Services.Cli.Common.SystemEnvironment; 3 | 4 | namespace Unity.Services.Cli.ServiceAccountAuthentication.Handlers; 5 | 6 | static class LogoutHandler 7 | { 8 | internal static async Task LogoutAsync( 9 | IAuthenticator authenticator, ISystemEnvironmentProvider environmentProvider, ILogger logger, 10 | CancellationToken cancellationToken) 11 | { 12 | var response = await authenticator.LogoutAsync(environmentProvider, cancellationToken); 13 | 14 | logger.LogInformation(response.Information); 15 | 16 | if (!string.IsNullOrEmpty(response.Warning)) 17 | { 18 | logger.LogWarning(response.Warning); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.ServiceAccountAuthentication/Service/IServiceAccountAuthenticationService.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.ServiceAccountAuthentication; 2 | 3 | public interface IServiceAccountAuthenticationService 4 | { 5 | /// 6 | /// Get the access token for the current user. 7 | /// Fails if the user isn't logged in. 8 | /// 9 | /// 10 | /// Returns the access token for the current user if they're logged in; 11 | /// throws otherwise. 12 | /// 13 | Task GetAccessTokenAsync(CancellationToken cancellationToken = default); 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Triggers.UnitTest/Utils/TestValues.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Triggers.UnitTest.Utils; 2 | 3 | public class TestValues 4 | { 5 | public const string ValidProjectId = "a912b1fd-541d-42e1-89f2-85436f27aabd"; 6 | public const string ValidEnvironmentId = "00000000-0000-0000-0000-000000000000"; 7 | public const int Limit = 10; 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Triggers/Deploy/TriggersFileItem.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using Unity.Services.Cli.Authoring.Model; 3 | using Unity.Services.DeploymentApi.Editor; 4 | 5 | namespace Unity.Services.Cli.Triggers.Deploy; 6 | 7 | [DataContract] 8 | public class TriggersFileItem : DeployContent 9 | { 10 | const string k_TriggersConfigFileType = "Triggers Config File"; 11 | 12 | public TriggersFileItem(TriggersConfigFile content, string path, float progress = 0, DeploymentStatus? status = null) 13 | : base( 14 | System.IO.Path.GetFileName(path), 15 | k_TriggersConfigFileType, 16 | path, 17 | progress, 18 | status) 19 | { 20 | Content = content; 21 | Path = path; 22 | } 23 | 24 | public TriggersConfigFile Content { get; } 25 | } 26 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Triggers/Deploy/TriggersSerializer.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Unity.Services.Triggers.Authoring.Core.Model; 3 | using Unity.Services.Triggers.Authoring.Core.Serialization; 4 | 5 | namespace Unity.Services.Cli.Triggers.Deploy; 6 | 7 | public class TriggersSerializer : ITriggersSerializer 8 | { 9 | public string Serialize(IList config) 10 | { 11 | var file = new TriggersConfigFile() 12 | { 13 | Configs = config.Cast().ToList() 14 | }; 15 | return file.FileBodyText; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Triggers/IO/FileSystem.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Triggers.Authoring.Core.IO; 2 | 3 | namespace Unity.Services.Cli.Triggers.IO; 4 | 5 | class FileSystem : Common.IO.FileSystem, IFileSystem 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Triggers/IO/ITriggersResourceLoader.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.Cli.Triggers.Deploy; 2 | 3 | namespace Unity.Services.Cli.Triggers.IO; 4 | 5 | interface ITriggersResourceLoader 6 | { 7 | Task LoadResource( 8 | string filePath, 9 | CancellationToken cancellationToken); 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli.Triggers/TriggersConstants.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.Cli.Triggers; 2 | 3 | public static class TriggersConstants 4 | { 5 | public const string DeployFileExtension = ".tr"; 6 | public const string ServiceType = "Triggers"; 7 | public const string ServiceName = "triggers"; 8 | } 9 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "Unity.Services.Cli": { 5 | "commandName": "Project", 6 | "workingDirectory": "$(SolutionDir)/../", 7 | "commandLineArgs": "-h" 8 | }, 9 | "Unity.Services.Cli.PrintTree": { 10 | "commandName": "Project", 11 | "workingDirectory": "$(SolutionDir)/../", 12 | "commandLineArgs": "--print-tree" 13 | }, 14 | "Unity.Services.Cli.PrintTreeFull": { 15 | "commandName": "Project", 16 | "workingDirectory": "$(SolutionDir)/../", 17 | "commandLineArgs": "--print-tree --print-tree-show-hidden" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Cli/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Warning" 7 | } 8 | }, 9 | "FeatureManagement": { 10 | "GameServerHosting": true, 11 | "GameServerHostingBuild": true, 12 | "GameServerHostingAuthoring": false 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.CloudContentDelivery.Authoring.Core/Deploy/DeployResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Unity.Services.CloudContentDelivery.Authoring.Core.Model; 3 | 4 | namespace Unity.Services.CloudContentDelivery.Authoring.Core.Deploy 5 | { 6 | public class DeployResult 7 | { 8 | public List Created { get; set; } 9 | public List Updated { get; set; } 10 | public List Deleted { get; set; } 11 | public List Deployed { get; set; } 12 | public List Failed { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.CloudContentDelivery.Authoring.Core/Deploy/ICloudContentDeliveryDeploymentHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Unity.Services.CloudContentDelivery.Authoring.Core.Model; 5 | 6 | namespace Unity.Services.CloudContentDelivery.Authoring.Core.Deploy 7 | { 8 | public interface ICloudContentDeliveryDeploymentHandler 9 | { 10 | Task DeployAsync(IReadOnlyList localResources, 11 | bool dryRun = false, 12 | bool reconcile = false, 13 | CancellationToken token = default); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.CloudContentDelivery.Authoring.Core/Fetch/FetchResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Unity.Services.CloudContentDelivery.Authoring.Core.Model; 3 | 4 | namespace Unity.Services.CloudContentDelivery.Authoring.Core.Fetch 5 | { 6 | public class FetchResult 7 | { 8 | public List Created { get; set; } 9 | public List Updated { get; set; } 10 | public List Deleted { get; set; } 11 | public List Fetched { get; set; } 12 | public List Failed { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.CloudContentDelivery.Authoring.Core/Fetch/ICloudContentDeliveryFetchHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Unity.Services.CloudContentDelivery.Authoring.Core.Model; 5 | 6 | namespace Unity.Services.CloudContentDelivery.Authoring.Core.Fetch 7 | { 8 | public interface ICloudContentDeliveryFetchHandler 9 | { 10 | public Task FetchAsync( 11 | string rootDirectory, 12 | IReadOnlyList localResources, 13 | bool dryRun = false, 14 | bool reconcile = false, 15 | CancellationToken token = default); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.CloudContentDelivery.Authoring.Core/IO/IFileSystem.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | namespace Unity.Services.CloudContentDelivery.Authoring.Core.IO 5 | { 6 | public interface IFileSystem 7 | { 8 | Task ReadAllText( 9 | string path, 10 | CancellationToken token = default(CancellationToken)); 11 | 12 | Task WriteAllText( 13 | string path, 14 | string contents, 15 | CancellationToken token = default(CancellationToken)); 16 | 17 | Task Delete(string path, CancellationToken token = default(CancellationToken)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.CloudContentDelivery.Authoring.Core/Model/IBucket.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.DeploymentApi.Editor; 2 | 3 | namespace Unity.Services.CloudContentDelivery.Authoring.Core.Model 4 | { 5 | public interface IBucket : IDeploymentItem, ITypedItem 6 | { 7 | string Id { get; } 8 | new float Progress { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.CloudContentDelivery.Authoring.Core/Service/ICloudContentDeliveryClient.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Unity.Services.CloudContentDelivery.Authoring.Core.Model; 5 | 6 | namespace Unity.Services.CloudContentDelivery.Authoring.Core.Service 7 | { 8 | //This is a sample IServiceClient and might not map to your existing admin APIs 9 | public interface ICloudContentDeliveryClient 10 | { 11 | void Initialize(string environmentId, string projectId, CancellationToken cancellationToken); 12 | 13 | Task Get(string name); 14 | Task Update(IBucket bucket); 15 | Task Create(IBucket bucket); 16 | Task Delete(IBucket bucket); 17 | Task> List(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.CloudSave.Authoring.Core/Deploy/DeployResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Unity.Services.CloudSave.Authoring.Core.Model; 3 | 4 | namespace Unity.Services.CloudSave.Authoring.Core.Deploy 5 | { 6 | public class DeployResult 7 | { 8 | public IReadOnlyList Deployed { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.CloudSave.Authoring.Core/Deploy/ICloudSaveDeploymentHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Unity.Services.CloudSave.Authoring.Core.Model; 5 | 6 | namespace Unity.Services.CloudSave.Authoring.Core.Deploy 7 | { 8 | public interface ICloudSaveDeploymentHandler 9 | { 10 | Task DeployAsync( 11 | IReadOnlyList localResources, 12 | bool dryRun = false, 13 | bool reconcile = false, 14 | CancellationToken token = default); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.CloudSave.Authoring.Core/Fetch/FetchResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Unity.Services.CloudSave.Authoring.Core.Model; 3 | 4 | namespace Unity.Services.CloudSave.Authoring.Core.Fetch 5 | { 6 | public class FetchResult 7 | { 8 | public IReadOnlyList Fetched { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.CloudSave.Authoring.Core/Fetch/ICloudSaveFetchHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Unity.Services.CloudSave.Authoring.Core.Model; 5 | 6 | namespace Unity.Services.CloudSave.Authoring.Core.Fetch 7 | { 8 | public interface ICloudSaveFetchHandler 9 | { 10 | public Task FetchAsync( 11 | string rootDirectory, 12 | IReadOnlyList localResources, 13 | bool dryRun = false, 14 | bool reconcile = false, 15 | CancellationToken token = default); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.CloudSave.Authoring.Core/IO/ICloudSaveSimpleResourceLoader.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | using Unity.Services.CloudSave.Authoring.Core.Model; 4 | 5 | namespace Unity.Services.CloudSave.Authoring.Core.IO 6 | { 7 | public interface ICloudSaveSimpleResourceLoader 8 | { 9 | Task ReadResource(string path, CancellationToken token); 10 | Task CreateOrUpdateResource(IResourceDeploymentItem deployableItem, CancellationToken token); 11 | Task DeleteResource(IResourceDeploymentItem deploymentItem, CancellationToken token); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.CloudSave.Authoring.Core/IO/IFileSystem.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | namespace Unity.Services.CloudSave.Authoring.Core.IO 5 | { 6 | public interface IFileSystem 7 | { 8 | Task ReadAllText( 9 | string path, 10 | CancellationToken token = default(CancellationToken)); 11 | 12 | Task WriteAllText( 13 | string path, 14 | string contents, 15 | CancellationToken token = default(CancellationToken)); 16 | 17 | Task Delete(string path, CancellationToken token = default(CancellationToken)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.CloudSave.Authoring.Core/Model/ClientException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Unity.Services.CloudSave.Authoring.Core.Model 4 | { 5 | public class ClientException : Exception 6 | { 7 | public ClientException(string message, Exception innerExcception) : base(message, innerExcception) 8 | { 9 | 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.CloudSave.Authoring.Core/Model/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.CloudSave.Authoring.Core.Model 2 | { 3 | public class Constants 4 | { 5 | //TODO: Modify this extension as appropriate 6 | public const string SimpleFileExtension = ".serv"; 7 | public const string Updated = "Updated"; 8 | public const string Created = "Created"; 9 | public const string Deleted = "Deleted"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.CloudSave.Authoring.Core/Model/SimpleResource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.ComponentModel; 5 | using System.Runtime.CompilerServices; 6 | using System.Runtime.Serialization; 7 | using Unity.Services.DeploymentApi.Editor; 8 | 9 | namespace Unity.Services.CloudSave.Authoring.Core.Model 10 | { 11 | [DataContract] 12 | public class SimpleResource : IResource 13 | { 14 | [DataMember] 15 | public string Id { get; set; } 16 | [DataMember] 17 | public string Name { get; set; } 18 | [DataMember] 19 | public string AStrValue { get; set; } 20 | [DataMember] 21 | public NestedObject NestedObj { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.ModuleTemplate.Authoring.Core/.template.config/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/template", 3 | "author": "UGS EdEx Team", 4 | "classifications": [ 5 | "Console", 6 | "UGS", 7 | "CLI", 8 | "Unity", 9 | "Services" 10 | ], 11 | "identity": "Ugs.Cli.ModuleDeploy", 12 | "name": "UGS CLI ModuleDeploy", 13 | "shortName": "UgsCliModuleDeploy", 14 | "tags": { 15 | "language": "C#", 16 | "type": "project" 17 | }, 18 | "sourceName": "ModuleTemplate" 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.ModuleTemplate.Authoring.Core/Deploy/DeployResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Unity.Services.DeploymentApi.Editor; 3 | 4 | namespace Unity.Services.ModuleTemplate.Authoring.Core.Deploy 5 | { 6 | public class DeployResult 7 | { 8 | public IReadOnlyList Deployed { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.ModuleTemplate.Authoring.Core/Deploy/ICompoundModuleTemplateDeploymentHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Unity.Services.ModuleTemplate.Authoring.Core.Model; 5 | 6 | namespace Unity.Services.ModuleTemplate.Authoring.Core.Deploy 7 | { 8 | public interface ICompoundModuleTemplateDeploymentHandler 9 | { 10 | Task DeployAsync( 11 | IReadOnlyList compoundLocalResources, 12 | bool dryRun = false, 13 | bool reconcile = false, 14 | CancellationToken token = default); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.ModuleTemplate.Authoring.Core/Deploy/IModuleTemplateDeploymentHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Unity.Services.ModuleTemplate.Authoring.Core.Model; 5 | 6 | namespace Unity.Services.ModuleTemplate.Authoring.Core.Deploy 7 | { 8 | public interface IModuleTemplateDeploymentHandler 9 | { 10 | Task DeployAsync( 11 | IReadOnlyList localResources, 12 | bool dryRun = false, 13 | bool reconcile = false, 14 | CancellationToken token = default); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.ModuleTemplate.Authoring.Core/Fetch/FetchResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Unity.Services.DeploymentApi.Editor; 3 | 4 | namespace Unity.Services.ModuleTemplate.Authoring.Core.Fetch 5 | { 6 | public class FetchResult 7 | { 8 | public IReadOnlyList Fetched { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.ModuleTemplate.Authoring.Core/Fetch/ICompoundModuleTemplateFetchHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Unity.Services.ModuleTemplate.Authoring.Core.Model; 5 | 6 | namespace Unity.Services.ModuleTemplate.Authoring.Core.Fetch 7 | { 8 | public interface ICompoundModuleTemplateFetchHandler 9 | { 10 | public Task FetchAsync( 11 | string rootDirectory, 12 | IReadOnlyList compoundLocalResources, 13 | bool dryRun = false, 14 | bool reconcile = false, 15 | CancellationToken token = default); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.ModuleTemplate.Authoring.Core/Fetch/IModuleTemplateFetchHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Unity.Services.ModuleTemplate.Authoring.Core.Model; 5 | 6 | namespace Unity.Services.ModuleTemplate.Authoring.Core.Fetch 7 | { 8 | public interface IModuleTemplateFetchHandler 9 | { 10 | public Task FetchAsync( 11 | string rootDirectory, 12 | IReadOnlyList localResources, 13 | bool dryRun = false, 14 | bool reconcile = false, 15 | CancellationToken token = default); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.ModuleTemplate.Authoring.Core/IO/IFileSystem.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | namespace Unity.Services.ModuleTemplate.Authoring.Core.IO 5 | { 6 | public interface IFileSystem //Abstracted away - delete 7 | { 8 | Task ReadAllText( 9 | string path, 10 | CancellationToken token = default(CancellationToken)); 11 | 12 | Task WriteAllText( 13 | string path, 14 | string contents, 15 | CancellationToken token = default(CancellationToken)); 16 | 17 | Task Delete(string path, CancellationToken token = default(CancellationToken)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.ModuleTemplate.Authoring.Core/IO/IModuleTemplateCompoundResourceLoader.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | using Unity.Services.ModuleTemplate.Authoring.Core.Model; 4 | 5 | namespace Unity.Services.ModuleTemplate.Authoring.Core.IO 6 | { 7 | public interface IModuleTemplateCompoundResourceLoader 8 | { 9 | Task ReadResource(string path, CancellationToken token); 10 | Task CreateOrUpdateResource(ICompoundResourceDeploymentItem deployableItem, CancellationToken token); 11 | Task DeleteResource(ICompoundResourceDeploymentItem deploymentItem, CancellationToken token); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.ModuleTemplate.Authoring.Core/IO/IModuleTemplateSimpleResourceLoader.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | using Unity.Services.ModuleTemplate.Authoring.Core.Model; 4 | 5 | namespace Unity.Services.ModuleTemplate.Authoring.Core.IO 6 | { 7 | public interface IModuleTemplateSimpleResourceLoader 8 | { 9 | Task ReadResource(string path, CancellationToken token); 10 | Task CreateOrUpdateResource(IResourceDeploymentItem deployableItem, CancellationToken token); 11 | Task DeleteResource(IResourceDeploymentItem deploymentItem, CancellationToken token); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.ModuleTemplate.Authoring.Core/Model/ClientException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Unity.Services.ModuleTemplate.Authoring.Core.Model 4 | { 5 | public class ClientException : Exception 6 | { 7 | public ClientException(string message, Exception innerExcception) : base(message, innerExcception) 8 | { 9 | 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.ModuleTemplate.Authoring.Core/Model/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace Unity.Services.ModuleTemplate.Authoring.Core.Model 2 | { 3 | public class Constants 4 | { 5 | //TODO: Modify this extension as appropriate 6 | public const string SimpleFileExtension = ".serv"; 7 | public const string CompoundFileExtension = ".cerv"; 8 | public const string Updated = "Updated"; 9 | public const string Created = "Created"; 10 | public const string Deleted = "Deleted"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.ModuleTemplate.Authoring.Core/Model/SimpleResource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.ComponentModel; 5 | using System.Runtime.CompilerServices; 6 | using System.Runtime.Serialization; 7 | using Unity.Services.DeploymentApi.Editor; 8 | 9 | namespace Unity.Services.ModuleTemplate.Authoring.Core.Model 10 | { 11 | [DataContract] 12 | public class SimpleResource : IResource 13 | { 14 | [DataMember] 15 | public string Id { get; set; } 16 | [DataMember] 17 | public string Name { get; set; } 18 | [DataMember] 19 | public string AStrValue { get; set; } 20 | [DataMember] 21 | public NestedObject NestedObj { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Scheduler.Authoring.Core/Deploy/DeployResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Unity.Services.Scheduler.Authoring.Core.Model; 3 | 4 | namespace Unity.Services.Scheduler.Authoring.Core.Deploy 5 | { 6 | public class DeployResult 7 | { 8 | public List Created { get; set; } 9 | public List Updated { get; set; } 10 | public List Deleted { get; set; } 11 | public List Deployed { get; set; } 12 | public List Failed { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Scheduler.Authoring.Core/Deploy/IScheduleDeploymentHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Unity.Services.Scheduler.Authoring.Core.Model; 5 | 6 | namespace Unity.Services.Scheduler.Authoring.Core.Deploy 7 | { 8 | public interface IScheduleDeploymentHandler 9 | { 10 | Task DeployAsync(IReadOnlyList localResources, 11 | bool dryRun = false, 12 | bool reconcile = false, 13 | CancellationToken token = default); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Scheduler.Authoring.Core/Fetch/FetchResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Unity.Services.Scheduler.Authoring.Core.Model; 3 | 4 | namespace Unity.Services.Scheduler.Authoring.Core.Fetch 5 | { 6 | public class FetchResult 7 | { 8 | public List Created { get; set; } 9 | public List Updated { get; set; } 10 | public List Deleted { get; set; } 11 | public List Fetched { get; set; } 12 | public List Failed { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Scheduler.Authoring.Core/Fetch/IScheduleFetchHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Unity.Services.Scheduler.Authoring.Core.Model; 5 | 6 | namespace Unity.Services.Scheduler.Authoring.Core.Fetch 7 | { 8 | public interface IScheduleFetchHandler 9 | { 10 | public Task FetchAsync( 11 | string rootDirectory, 12 | IReadOnlyList localResources, 13 | bool dryRun = false, 14 | bool reconcile = false, 15 | CancellationToken token = default); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Scheduler.Authoring.Core/IO/IFileSystem.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | namespace Unity.Services.Scheduler.Authoring.Core.IO 5 | { 6 | public interface IFileSystem 7 | { 8 | Task ReadAllText( 9 | string path, 10 | CancellationToken token = default(CancellationToken)); 11 | 12 | Task WriteAllText( 13 | string path, 14 | string contents, 15 | CancellationToken token = default(CancellationToken)); 16 | 17 | Task Delete(string path, CancellationToken token = default(CancellationToken)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Scheduler.Authoring.Core/Model/IScheduleConfig.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.DeploymentApi.Editor; 2 | 3 | namespace Unity.Services.Scheduler.Authoring.Core.Model 4 | { 5 | public interface IScheduleConfig : IDeploymentItem, ITypedItem 6 | { 7 | string Id { get; set; } 8 | string EventName { get; } 9 | string ScheduleType { get; } 10 | string Schedule { get; } 11 | int PayloadVersion { get; } 12 | string Payload { get; } 13 | 14 | new float Progress { get; set; } 15 | new string Path { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Scheduler.Authoring.Core/Model/ScheduleComparer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Unity.Services.Scheduler.Authoring.Core.Model 4 | { 5 | public class ScheduleComparer : IEqualityComparer 6 | { 7 | public bool Equals(IScheduleConfig x, IScheduleConfig y) 8 | { 9 | if (ReferenceEquals(x, y)) return true; 10 | if (ReferenceEquals(x, null)) return false; 11 | if (ReferenceEquals(y, null)) return false; 12 | if (x.GetType() != y.GetType()) return false; 13 | return x.Name == y.Name; 14 | } 15 | 16 | public int GetHashCode(IScheduleConfig obj) 17 | { 18 | return (obj.Name != null ? obj.Name.GetHashCode() : 0); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Scheduler.Authoring.Core/Serialization/ISchedulesSerializer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Unity.Services.Scheduler.Authoring.Core.Model; 3 | 4 | namespace Unity.Services.Scheduler.Authoring.Core.Serialization 5 | { 6 | public interface ISchedulesSerializer 7 | { 8 | string Serialize(IList config); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Scheduler.Authoring.Core/Service/ISchedulerClient.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Unity.Services.Scheduler.Authoring.Core.Model; 5 | 6 | namespace Unity.Services.Scheduler.Authoring.Core.Service 7 | { 8 | //This is a sample IServiceClient and might not map to your existing admin APIs 9 | public interface ISchedulerClient 10 | { 11 | Task Initialize(string environmentId, string projectId, CancellationToken cancellationToken); 12 | 13 | Task Get(string id); 14 | Task Update(IScheduleConfig resource); 15 | Task Create(IScheduleConfig resource); 16 | Task Delete(IScheduleConfig resource); 17 | Task> List(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Triggers.Authoring.Core/Deploy/DeployResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Unity.Services.Triggers.Authoring.Core.Model; 3 | 4 | namespace Unity.Services.Triggers.Authoring.Core.Deploy 5 | { 6 | public class DeployResult 7 | { 8 | public List Created { get; set; } 9 | public List Updated { get; set; } 10 | public List Deleted { get; set; } 11 | public List Deployed { get; set; } 12 | public List Failed { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Triggers.Authoring.Core/Deploy/ITriggersDeploymentHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Unity.Services.Triggers.Authoring.Core.Model; 5 | 6 | namespace Unity.Services.Triggers.Authoring.Core.Deploy 7 | { 8 | public interface ITriggersDeploymentHandler 9 | { 10 | Task DeployAsync(IReadOnlyList localResources, 11 | bool dryRun = false, 12 | bool reconcile = false, 13 | CancellationToken token = default); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Triggers.Authoring.Core/Fetch/FetchResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Unity.Services.Triggers.Authoring.Core.Model; 3 | 4 | namespace Unity.Services.Triggers.Authoring.Core.Fetch 5 | { 6 | public class FetchResult 7 | { 8 | public List Created { get; set; } 9 | public List Updated { get; set; } 10 | public List Deleted { get; set; } 11 | public List Fetched { get; set; } 12 | public List Failed { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Triggers.Authoring.Core/Fetch/ITriggersFetchHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Unity.Services.Triggers.Authoring.Core.Model; 5 | 6 | namespace Unity.Services.Triggers.Authoring.Core.Fetch 7 | { 8 | public interface ITriggersFetchHandler 9 | { 10 | public Task FetchAsync( 11 | string rootDirectory, 12 | IReadOnlyList localResources, 13 | bool dryRun = false, 14 | bool reconcile = false, 15 | CancellationToken token = default); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Triggers.Authoring.Core/IO/IFileSystem.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | 4 | namespace Unity.Services.Triggers.Authoring.Core.IO 5 | { 6 | public interface IFileSystem 7 | { 8 | Task ReadAllText( 9 | string path, 10 | CancellationToken token = default(CancellationToken)); 11 | 12 | Task WriteAllText( 13 | string path, 14 | string contents, 15 | CancellationToken token = default(CancellationToken)); 16 | 17 | Task Delete(string path, CancellationToken token = default(CancellationToken)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Triggers.Authoring.Core/Model/ITriggerConfig.cs: -------------------------------------------------------------------------------- 1 | using Unity.Services.DeploymentApi.Editor; 2 | 3 | namespace Unity.Services.Triggers.Authoring.Core.Model 4 | { 5 | public interface ITriggerConfig : IDeploymentItem, ITypedItem 6 | { 7 | string Id { get; set; } 8 | new float Progress { get; set; } 9 | 10 | string EventType { get; } 11 | string ActionType { get; } 12 | string ActionUrn { get; } 13 | string Filter { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Triggers.Authoring.Core/Model/TriggerComparer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Unity.Services.Triggers.Authoring.Core.Model 4 | { 5 | public class TriggerComparer : IEqualityComparer 6 | { 7 | public bool Equals(ITriggerConfig x, ITriggerConfig y) 8 | { 9 | if (ReferenceEquals(x, y)) return true; 10 | if (ReferenceEquals(x, null)) return false; 11 | if (ReferenceEquals(y, null)) return false; 12 | if (x.GetType() != y.GetType()) return false; 13 | return x.Name == y.Name; 14 | } 15 | 16 | public int GetHashCode(ITriggerConfig obj) 17 | { 18 | return (obj.Name != null ? obj.Name.GetHashCode() : 0); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Triggers.Authoring.Core/Serialization/ITriggersSerializer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Unity.Services.Triggers.Authoring.Core.Model; 3 | 4 | namespace Unity.Services.Triggers.Authoring.Core.Serialization 5 | { 6 | public interface ITriggersSerializer 7 | { 8 | string Serialize(IList config); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Unity.Services.Cli/Unity.Services.Triggers.Authoring.Core/Service/ITriggersClient.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Unity.Services.Triggers.Authoring.Core.Model; 5 | 6 | namespace Unity.Services.Triggers.Authoring.Core.Service 7 | { 8 | public interface ITriggersClient 9 | { 10 | void Initialize(string environmentId, string projectId, CancellationToken cancellationToken); 11 | 12 | Task Get(string name); 13 | Task Update(ITriggerConfig triggerConfig); 14 | Task Create(ITriggerConfig triggerConfig); 15 | Task Delete(ITriggerConfig triggerConfig); 16 | Task> List(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Unity.Services.Cli/nuget.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test.runsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | ./TestResults 4 | ./TestResults 5 | 3600000 6 | 7 | 8 | 9 | 10 | 11 | quiet 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | --------------------------------------------------------------------------------