public async Task DatasetSample()
        {
            #region Snippet:CreateDatasetClient
            // Replace the string below with your actual endpoint url.
            string endpoint = "<my-endpoint-url>";
            /*@@*/ endpoint = TestEnvironment.EndpointUrl;
            DatasetClient client = new DatasetClient(endpoint: new Uri(endpoint), credential: new DefaultAzureCredential());
            #endregion

            #region Snippet:CreateDataset
            DatasetCreateOrUpdateDatasetOperation operation      = client.StartCreateOrUpdateDataset("MyDataset", new DatasetResource(new Dataset(new LinkedServiceReference(LinkedServiceReferenceType.LinkedServiceReference, TestEnvironment.WorkspaceName + "-WorkspaceDefaultStorage"))));
            Response <DatasetResource>            createdDataset = await operation.WaitForCompletionAsync();

            #endregion

            #region Snippet:RetrieveDataset
            DatasetResource retrievedDataset = client.GetDataset("MyDataset");
            #endregion

            #region Snippet:ListDatasets
            Pageable <DatasetResource> datasets = client.GetDatasetsByWorkspace();
            foreach (DatasetResource dataset in datasets)
            {
                System.Console.WriteLine(dataset.Name);
            }
            #endregion

            #region Snippet:DeleteDataset
            client.StartDeleteDataset("MyDataset");
            #endregion
        }
        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));
        }
        public async Task TestCreateDataset()
        {
            string datasetName = Recording.GenerateName("Dataset");
            DatasetCreateOrUpdateDatasetOperation operation = await DatasetClient.StartCreateOrUpdateDatasetAsync(datasetName, new DatasetResource(new Dataset(new LinkedServiceReference(LinkedServiceReferenceType.LinkedServiceReference, TestEnvironment.WorkspaceName + "-WorkspaceDefaultStorage"))));

            DatasetResource dataset = await operation.WaitForCompletionAsync();

            Assert.AreEqual(datasetName, dataset.Name);
        }
 public DomoClient(IDomoConfig config)
 {
     _config  = config;
     Datasets = new DatasetClient(_config);
     Groups   = new GroupClient(_config);
     Pages    = new PageClient(_config);
     Streams  = new StreamClient(_config);
     Users    = new UserClient(_config);
 }
        public async Task TestGetDataset()
        {
            await foreach (var expectedDataset in DatasetClient.GetDatasetsByWorkspaceAsync())
            {
                DatasetResource actualDataset = await DatasetClient.GetDatasetAsync(expectedDataset.Name);

                Assert.AreEqual(expectedDataset.Name, actualDataset.Name);
                Assert.AreEqual(expectedDataset.Id, actualDataset.Id);
            }
        }
        public async Task TestDeleteDataset()
        {
            var operation = await DatasetClient.StartDeleteDatasetAsync("MyDataset");

            while (!operation.HasValue)
            {
                operation.UpdateStatus();
            }
            Assert.AreEqual(200, operation.Value.Status);
        }
        public async Task TestCreateDataset()
        {
            var operation = await DatasetClient.StartCreateOrUpdateDatasetAsync("MyDataset", new DatasetResource(new Dataset(new LinkedServiceReference(LinkedServiceReferenceType.LinkedServiceReference, "testsynapseworkspace-WorkspaceDefaultStorage"))));

            while (!operation.HasValue)
            {
                operation.UpdateStatus();
            }
            Assert.AreEqual("MyDataset", operation.Value.Name);
        }
Example #8
0
        public void CreateClient()
        {
            // Environment variable with the Synapse workspace endpoint.
            string workspaceUrl = TestEnvironment.WorkspaceUrl;

            #region Snippet:CreateDatasetClient
            // Create a new Dataset client using the default credential from Azure.Identity using environment variables previously set,
            // including AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, and AZURE_TENANT_ID.
            DatasetClient client = new DatasetClient(endpoint: new Uri(workspaceUrl), credential: new DefaultAzureCredential());
            #endregion

            this.DatasetClient = client;
        }
        public async Task TestDeleteDataset()
        {
            DatasetClient client      = CreateClient();
            string        datasetName = Recording.GenerateId("Dataset", 16);

            DatasetCreateOrUpdateDatasetOperation createOperation = await client.StartCreateOrUpdateDatasetAsync(datasetName, new DatasetResource(new Dataset(new LinkedServiceReference(LinkedServiceReferenceType.LinkedServiceReference, TestEnvironment.WorkspaceName + "-WorkspaceDefaultStorage"))));

            await createOperation.WaitForCompletionAsync();

            DatasetDeleteDatasetOperation deleteOperation = await client.StartDeleteDatasetAsync(datasetName);

            Response response = await deleteOperation.WaitForCompletionAsync();

            Assert.AreEqual(200, response.Status);
        }
        public SynapseAnalyticsArtifactsClient(string workspaceName, IAzureContext context)
        {
            if (context == null)
            {
                throw new SynapseException(Resources.InvalidDefaultSubscription);
            }

            Settings = new JsonSerializerSettings
            {
                DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
                DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
                NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
                ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
                ContractResolver      = new ReadOnlyJsonContractResolver(),
                Converters            = new List <JsonConverter>
                {
                    new Iso8601TimeSpanConverter()
                }
            };
            Settings.Converters.Add(new TransformationJsonConverter());
            Settings.Converters.Add(new PolymorphicDeserializeJsonConverter <PSActivity>("type"));
            Settings.Converters.Add(new PolymorphicDeserializeJsonConverter <PSLinkedService>("type"));
            Settings.Converters.Add(new PolymorphicDeserializeJsonConverter <PSTrigger>("type"));
            Settings.Converters.Add(new PolymorphicDeserializeJsonConverter <PSDataset>("type"));
            Settings.Converters.Add(new PolymorphicDeserializeJsonConverter <PSDataFlow>("type"));

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

            _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));
        }
        static OperationalInterface()
        {
            Assembly thisAssm = Assembly.GetEntryAssembly();

            dataset = new DatasetClient("operational", Path.GetDirectoryName(thisAssm.Location) + "\\net.xml");
        }
 static OperationalInterface()
 {
     Assembly thisAssm = Assembly.GetEntryAssembly();
     dataset = new DatasetClient("operational", Path.GetDirectoryName(thisAssm.Location) + "\\net.xml");
 }