public SynapseAnalyticsArtifactsClient(string workspaceName, IAzureContext context)
        {
            if (context == null)
            {
                throw new AzPSInvalidOperationException(Resources.InvalidDefaultSubscription);
            }

            _context = context;
            string suffix = context.Environment.GetEndpoint(AzureEnvironment.ExtendedEndpoint.AzureSynapseAnalyticsEndpointSuffix);
            Uri    uri    = new Uri("https://" + workspaceName + "." + suffix);

            _endpoint                   = uri;
            _pipelineClient             = new PipelineClient(uri, new AzureSessionCredential(context));
            _pipelineRunClient          = new PipelineRunClient(uri, new AzureSessionCredential(context));
            _linkedServiceClient        = new LinkedServiceClient(uri, new AzureSessionCredential(context));
            _notebookClient             = new NotebookClient(uri, new AzureSessionCredential(context));
            _triggerClient              = new TriggerClient(uri, new AzureSessionCredential(context));
            _triggerRunClient           = new TriggerRunClient(uri, new AzureSessionCredential(context));
            _datasetClient              = new DatasetClient(uri, new AzureSessionCredential(context));
            _dataFlowClient             = new DataFlowClient(uri, new AzureSessionCredential(context));
            _dataFlowDebugSessionClient = new DataFlowDebugSessionClient(uri, new AzureSessionCredential(context));
            _bigDataPoolsClient         = new BigDataPoolsClient(uri, new AzureSessionCredential(context));
            _sparkJobDefinitionClient   = new SparkJobDefinitionClient(uri, new AzureSessionCredential(context));
            _sqlScriptClient            = new SqlScriptClient(uri, new AzureSessionCredential(context));
        }
Example #2
0
        public async Task TestDeleteSparkJob()
        {
            SqlScriptClient client = CreateClient();

            SqlScriptResource resource = await DisposableSqlScript.CreateResource(client, Recording);

            SqlScriptDeleteSqlScriptOperation deleteOperation = await client.StartDeleteSqlScriptAsync(resource.Name);

            await deleteOperation.WaitAndAssertSuccessfulCompletion();
        }
Example #3
0
            public static async ValueTask <SqlScriptResource> CreateResource(SqlScriptClient client, TestRecording recording)
            {
                string scriptName = recording.GenerateId("SqlScript", 16);
                // The connection string does not need to point to a real server, as we are not executing here
                SqlConnection connect = new SqlConnection(SqlConnectionType.SqlPool, "Server=tcp:nonexistant.sql.azuresynapse.net,1433;Database=nonexistant;User ID=user;Password=password;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;");
                SqlScript     script  = new SqlScript(new SqlScriptContent("SELECT NULL LIMIT 0;", connect));
                SqlScriptCreateOrUpdateSqlScriptOperation createOperation = await client.StartCreateOrUpdateSqlScriptAsync(scriptName, new SqlScriptResource (scriptName, script));

                return(await createOperation.WaitForCompletionAsync());
            }
Example #4
0
        public async Task TestGetScripts()
        {
            SqlScriptClient client = CreateClient();

            await using DisposableSqlScript singleScript = await DisposableSqlScript.Create(client, Recording);

            IList <SqlScriptResource> scripts = await client.GetSqlScriptsByWorkspaceAsync().ToListAsync();

            Assert.GreaterOrEqual(scripts.Count, 1);

            foreach (SqlScriptResource script in scripts)
            {
                SqlScriptResource actualScript = await client.GetSqlScriptAsync(script.Name);

                Assert.AreEqual(actualScript.Name, script.Name);
                Assert.AreEqual(actualScript.Id, script.Id);
                Assert.AreEqual(actualScript.Type, script.Type);
            }
        }
Example #5
0
        public async Task TestRenameSparkJob()
        {
            SqlScriptClient client = CreateClient();

            SqlScriptResource resource = await DisposableSqlScript.CreateResource(client, Recording);

            string newScriptName = Recording.GenerateId("SqlScript", 16);

            SqlScriptRenameSqlScriptOperation renameOperation = await client.StartRenameSqlScriptAsync(resource.Name, new ArtifactRenameRequest()
            {
                NewName = newScriptName
            });

            await renameOperation.WaitForCompletionResponseAsync();

            SqlScriptResource sparkJob = await client.GetSqlScriptAsync(newScriptName);

            Assert.AreEqual(newScriptName, sparkJob.Name);

            SqlScriptDeleteSqlScriptOperation deleteOperation = await client.StartDeleteSqlScriptAsync(newScriptName);

            await deleteOperation.WaitForCompletionResponseAsync();
        }
Example #6
0
 public static async ValueTask <DisposableSqlScript> Create(SqlScriptClient client, TestRecording recording) =>
 new DisposableSqlScript(client, await CreateResource(client, recording));
Example #7
0
 private DisposableSqlScript(SqlScriptClient client, SqlScriptResource resource)
 {
     _client  = client;
     Resource = resource;
 }