Skip to content

Commit 6a18a74

Browse files
committed
Release 4.1.0
1 parent ece3695 commit 6a18a74

File tree

136 files changed

+9974
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+9974
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using System.Threading;
2+
using System.Threading.Tasks;
3+
using Microsoft.Extensions.Logging;
4+
using Tableau.Migration.Content.Schedules;
5+
using Tableau.Migration.Content.Schedules.Cloud;
6+
using Tableau.Migration.Engine.Hooks.Transformers;
7+
using Tableau.Migration.Resources;
8+
9+
namespace Csharp.ExampleApplication.Hooks.Transformers
10+
{
11+
#region class
12+
public class SimpleScheduleStartAtTransformer<T>
13+
: ContentTransformerBase<T>
14+
where T : IWithSchedule<ICloudSchedule>
15+
{
16+
private readonly ILogger<IContentTransformer<T>>? _logger;
17+
18+
public SimpleScheduleStartAtTransformer(
19+
ISharedResourcesLocalizer localizer,
20+
ILogger<IContentTransformer<T>> logger)
21+
: base(
22+
localizer,
23+
logger)
24+
{
25+
_logger = logger;
26+
}
27+
28+
public override async Task<T?> TransformAsync(
29+
T itemToTransform,
30+
CancellationToken cancel)
31+
{
32+
// In this example, the `Start At` time is in the UTC time zone.
33+
if (itemToTransform.Schedule.FrequencyDetails.StartAt is not null)
34+
{
35+
// A simple conversion to the EDT time zone.
36+
var updatedStartAt = itemToTransform.Schedule.FrequencyDetails.StartAt.Value.AddHours(-4);
37+
38+
_logger?.LogInformation(
39+
@"Adjusting the 'Start At' from {previousStartAt} to {updatedStartAt}.",
40+
itemToTransform.Schedule.FrequencyDetails.StartAt.Value,
41+
updatedStartAt);
42+
43+
itemToTransform.Schedule.FrequencyDetails.StartAt = updatedStartAt;
44+
}
45+
46+
return await Task.FromResult(itemToTransform);
47+
}
48+
}
49+
#endregion
50+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from datetime import time
2+
from tableau_migration import (
3+
ContentTransformerBase,
4+
ICloudExtractRefreshTask
5+
)
6+
7+
class SimpleScheduleStartAtTransformer(ContentTransformerBase[ICloudExtractRefreshTask]):
8+
def transform(self, itemToTransform: ICloudExtractRefreshTask) -> ICloudExtractRefreshTask:
9+
# In this example, the `Start At` time is in the UTC time zone.
10+
if itemToTransform.schedule.frequency_details.start_at:
11+
prev_start_at = itemToTransform.schedule.frequency_details.start_at
12+
# A simple conversion to the EDT time zone.
13+
itemToTransform.schedule.frequency_details.start_at = time(prev_start_at.hour - 4, prev_start_at.minute, prev_start_at.second, prev_start_at.microsecond);
14+
15+
return itemToTransform
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Basic Configuration
2+
3+
## Migration Plan
4+
5+
The migration plan is a required input in the migration process. It defines the Source and Destination servers and the hooks executed during the migration. Consider the Migration Plan as the steps the Migration SDK follows to migrate the information from a given source to a given destination.
6+
7+
The [`IMigrationPlan`](xref:Tableau.Migration.IMigrationPlan) interface defines the Migration Plan structure. The easiest way to generate a new Migration Plan is using [`MigrationPlanBuilder`](xref:Tableau.Migration.Engine.MigrationPlanBuilder). Following are the steps needed before [building](#build) a new plan:
8+
9+
- [Define the required Source server](#source).
10+
- [Define the required Destination server](#destination).
11+
- [Define the required Migration Type](#migration-type).
12+
13+
### Source
14+
15+
The method [`MigrationPlanBuilder.FromSourceTableauServer`](xref:Tableau.Migration.Engine.MigrationPlanBuilder.FromSourceTableauServer(System.Uri,System.String,System.String,System.String,System.Boolean)) defines the source server by instantiating a new [`TableauSiteConnectionConfiguration`](xref:Tableau.Migration.Api.TableauSiteConnectionConfiguration) with the following parameters:
16+
17+
- **serverUrl**
18+
- **siteContentUrl:**(optional)
19+
- **accessTokenName**
20+
- **accessToken**
21+
22+
### Destination
23+
24+
The method [`MigrationPlanBuilder.ToDestinationTableauCloud`](xref:Tableau.Migration.Engine.MigrationPlanBuilder.ToDestinationTableauCloud(System.Uri,System.String,System.String,System.String,System.Boolean)) defines the destination server by instantiating a new [`TableauSiteConnectionConfiguration`](xref:Tableau.Migration.Api.TableauSiteConnectionConfiguration) with the following parameters:
25+
26+
- **podUrl**
27+
- **siteContentUrl** The site name on Tableau Cloud.
28+
- **accessTokenName**
29+
- **accessToken**
30+
31+
> [!Important]
32+
> Personal access tokens (PATs) are long-lived authentication tokens that allow you to sign in to the Tableau REST API without requiring hard-coded credentials or interactive sign-in. Revoke and generate a new PAT every day to keep your server secure. Access tokens should not be stored in plain text in application configuration files, and should instead use secure alternatives such as encryption or a secrets management system. If the source and destination sites are on the same server, separate PATs should be used.
33+
34+
### Migration Type
35+
36+
The method [`MigrationPlanBuilder.ForServerToCloud`](xref:Tableau.Migration.Engine.MigrationPlanBuilder.ForServerToCloud) will define the migration type and load all default hooks for a **Server to Cloud** migration.
37+
38+
### Build
39+
40+
The method [`MigrationPlanBuilder.Build`](xref:Tableau.Migration.Engine.MigrationPlanBuilder.Build) generates a Migration Plan ready to be used as an input to a migration process.

src/Documentation/articles/index.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Introduction
2+
3+
Welcome to the developer documentation for the Tableau Migration SDK. The Migration SDK is primarily written in C# using the [.NET](https://dotnet.microsoft.com/en-us/learn/dotnet/what-is-dotnet-framework) Framework. It includes a [Python API](~/api-python/index.md) to enable interoperability with Python.
4+
5+
## Supported languages
6+
7+
You can develop your migration application using one of the supported languages
8+
9+
- [Python](https://www.python.org/)
10+
- C# using the [.NET Framework](https://dotnet.microsoft.com/en-us/learn/dotnet/what-is-dotnet-framework)
11+
12+
## Prerequisites
13+
14+
To develop your application using the [Migration SDK](https://github.com/tableau/tableau-migration-sdk), you should
15+
16+
- Understand framework and language concepts for one of the languages the SDK supports.
17+
- Be able to design and write applications in one of the supported languages.
18+
- Understand how to import and use third party packages
19+
- Understand logging and general troubleshooting of applications.
20+
21+
## Quick Start
22+
23+
- Install a [.NET Runtime](https://dotnet.microsoft.com/en-us/download).
24+
- Install the Migration SDK
25+
26+
## [Python](#tab/Python)
27+
28+
Install using PIP
29+
- [PIP CLI](https://pip.pypa.io/en/stable/cli/pip_install): `pip install tableau_migration`
30+
31+
## [C#](#tab/CSharp)
32+
33+
Install using NuGet
34+
- [dotnet CLI](https://learn.microsoft.com/en-us/nuget/quickstart/install-and-use-a-package-using-the-dotnet-cli): `dotnet add package Tableau.Migration`
35+
- [Nuget Package Manager](https://learn.microsoft.com/en-us/nuget/quickstart/install-and-use-a-package-in-visual-studio): Search for `Tableau.Migration`.
36+
37+
---
38+
39+
- Use the sample code in one of the [Reference](#getting-started-and-api-reference) sections to get started.
40+
- Use the [Resource](#resources) sections to further customize your application.
41+
42+
## Getting started and API Reference
43+
44+
- [Python API Reference](~/api-python/index.md) : Getting started sample and the complete Python API Reference for comprehensive documentation.
45+
- [C# API Reference](~/api-csharp/index.md): Getting started sample and the complete C# API Reference for detailed documentation.
46+
47+
## Resources
48+
49+
- [Articles](~/articles/index.md): Articles covering a range of topics, including customization of the Migration SDK.
50+
- [Code Samples](~/samples/index.md): Code samples to kickstart your development process.
51+
52+
## Source Code
53+
54+
The Tableau Migration SDK is open source. The source code is in our [GitHub repo](https://github.com/tableau/tableau-migration-sdk).
55+
56+
## Contributing
57+
58+
Refer to this handy [contribution guide](https://github.com/tableau/tableau-migration-sdk/blob/main/CONTRIBUTING.md) if you would like to contribute to the Migration SDK.

src/Documentation/images/configuration.svg

Lines changed: 1 addition & 0 deletions
Loading

src/Documentation/images/hooks.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Batch Migration Completed
2+
3+
Batch Migration Completed Hooks allow custom logic to run when a migration batch completes.
4+
5+
The following samples cover some common scenarios:
6+
7+
- [Sample: Migration batch logging](~/samples/batch-migration-completed/log_migration_batches.md)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Bulk Post-Publish Hooks
2+
3+
Bulk post-publish hooks allow you to update content item batches after they are migrated to the destination.
4+
5+
The following samples cover some common scenarios:
6+
7+
- [Sample: Bulk logging](~/samples/bulk-post-publish/bulk_logging.md)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Filters
2+
3+
Filters allow you to skip migrating certain content items.
4+
5+
> [!Note]
6+
> Filters do not have a cascading effect. You will need to write similar filters for the related content items as well.
7+
8+
The following samples cover some common scenarios:
9+
10+
- [Sample: Filter projects by name](~/samples/filters/filter_projects_by_name.md)
11+
12+
- [Sample: Filter users by site role](~/samples/filters/filter_users_by_site_role.md)

src/Documentation/samples/index.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Code Samples
2+
3+
Once you have started building your migration using the example code in [C#](~/api-csharp/index.md) or [Python](~/api-python/index.md), you may want to further customize your migration using hooks. This section provides code samples to assist you.
4+
5+
[Learn more about hooks here.](~/articles/hooks/index.md)
6+
7+
## Hook Registration
8+
9+
To use hooks, you need to register them with the [plan builder](~/articles/configuration.md#migration-plan).
10+
11+
The process of registering hooks differs slightly between C# and Python, as described below.
12+
13+
# [Python](#tab/Python)
14+
15+
In Python, injecting an object into the class constructor is not supported, and in most cases, it is unnecessary.
16+
17+
To register a Python hook object, simply create the object and add it to the appropriate hook type collection.
18+
19+
**Generic Form:** `plan_builder.[hook type collection].add([hook object])`
20+
21+
**Example:**
22+
```
23+
plan_builder.filters.add(UnlicensedUsersFilter)
24+
```
25+
26+
# [C#](#tab/CSharp)
27+
28+
In C#, the hook object should be registered with Dependency Injection (DI). This allows hooks to have any object injected into the constructor without concern for the source of the object.
29+
30+
Learn more about [dependency injection](~/articles/dependency_injection.md).
31+
32+
To register your hook object with the dependency injection service provider, simply add it.
33+
34+
**Generic Form:** `services.AddScoped<[Object type]>();`
35+
36+
**Example:**
37+
```
38+
services.AddScoped<UnlicensedUsersFilter>();
39+
```
40+
41+
Once the hook is registered with DI, it must be added to the appropriate [hook collection](~/articles/hooks/custom_hooks.md).
42+
43+
**Generic Form:** `_planBuilder.[hook type collection].Add<[object name], [hook type]>();`
44+
45+
**Example:**
46+
```
47+
_planBuilder.Filters.Add<UnlicensedUsersFilter, IUser>();
48+
```

0 commit comments

Comments
 (0)