diff --git a/profiles/preview/datafactory/mgmt/datafactory/models.go b/profiles/preview/datafactory/mgmt/datafactory/models.go index 14e36c248571..2d3fcdec63ed 100644 --- a/profiles/preview/datafactory/mgmt/datafactory/models.go +++ b/profiles/preview/datafactory/mgmt/datafactory/models.go @@ -885,6 +885,7 @@ const ( PUT WebActivityMethod = original.PUT ) +type AccessPolicyResponse = original.AccessPolicyResponse type BasicActivity = original.BasicActivity type Activity = original.Activity type ActivityDependency = original.ActivityDependency @@ -1393,6 +1394,7 @@ type UntilActivity = original.UntilActivity type UntilActivityTypeProperties = original.UntilActivityTypeProperties type UpdateIntegrationRuntimeNodeRequest = original.UpdateIntegrationRuntimeNodeRequest type UpdateIntegrationRuntimeRequest = original.UpdateIntegrationRuntimeRequest +type UserAccessPolicy = original.UserAccessPolicy type UserProperty = original.UserProperty type VariableSpecification = original.VariableSpecification type VerticaLinkedService = original.VerticaLinkedService diff --git a/services/datafactory/mgmt/2018-06-01/datafactory/datafactoryapi/interfaces.go b/services/datafactory/mgmt/2018-06-01/datafactory/datafactoryapi/interfaces.go index e1e672f2bd32..5d7be5c38973 100644 --- a/services/datafactory/mgmt/2018-06-01/datafactory/datafactoryapi/interfaces.go +++ b/services/datafactory/mgmt/2018-06-01/datafactory/datafactoryapi/interfaces.go @@ -36,6 +36,7 @@ type FactoriesClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, factoryName string, factory datafactory.Factory, ifMatch string) (result datafactory.Factory, err error) Delete(ctx context.Context, resourceGroupName string, factoryName string) (result autorest.Response, err error) Get(ctx context.Context, resourceGroupName string, factoryName string, ifNoneMatch string) (result datafactory.Factory, err error) + GetDataPlaneAccess(ctx context.Context, resourceGroupName string, factoryName string, policy datafactory.UserAccessPolicy) (result datafactory.AccessPolicyResponse, err error) GetGitHubAccessToken(ctx context.Context, resourceGroupName string, factoryName string, gitHubAccessTokenRequest datafactory.GitHubAccessTokenRequest) (result datafactory.GitHubAccessTokenResponse, err error) List(ctx context.Context) (result datafactory.FactoryListResponsePage, err error) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result datafactory.FactoryListResponsePage, err error) diff --git a/services/datafactory/mgmt/2018-06-01/datafactory/factories.go b/services/datafactory/mgmt/2018-06-01/datafactory/factories.go index 72b0edd272cd..09e0ed6d9283 100644 --- a/services/datafactory/mgmt/2018-06-01/datafactory/factories.go +++ b/services/datafactory/mgmt/2018-06-01/datafactory/factories.go @@ -423,6 +423,98 @@ func (client FactoriesClient) GetResponder(resp *http.Response) (result Factory, return } +// GetDataPlaneAccess get Data Plane access. +// Parameters: +// resourceGroupName - the resource group name. +// factoryName - the factory name. +// policy - data Plane user access policy definition. +func (client FactoriesClient) GetDataPlaneAccess(ctx context.Context, resourceGroupName string, factoryName string, policy UserAccessPolicy) (result AccessPolicyResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FactoriesClient.GetDataPlaneAccess") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: factoryName, + Constraints: []validation.Constraint{{Target: "factoryName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "factoryName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "factoryName", Name: validation.Pattern, Rule: `^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("datafactory.FactoriesClient", "GetDataPlaneAccess", err.Error()) + } + + req, err := client.GetDataPlaneAccessPreparer(ctx, resourceGroupName, factoryName, policy) + if err != nil { + err = autorest.NewErrorWithError(err, "datafactory.FactoriesClient", "GetDataPlaneAccess", nil, "Failure preparing request") + return + } + + resp, err := client.GetDataPlaneAccessSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datafactory.FactoriesClient", "GetDataPlaneAccess", resp, "Failure sending request") + return + } + + result, err = client.GetDataPlaneAccessResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datafactory.FactoriesClient", "GetDataPlaneAccess", resp, "Failure responding to request") + } + + return +} + +// GetDataPlaneAccessPreparer prepares the GetDataPlaneAccess request. +func (client FactoriesClient) GetDataPlaneAccessPreparer(ctx context.Context, resourceGroupName string, factoryName string, policy UserAccessPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "factoryName": autorest.Encode("path", factoryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/getDataPlaneAccess", pathParameters), + autorest.WithJSON(policy), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDataPlaneAccessSender sends the GetDataPlaneAccess request. The method will close the +// http.Response Body if it receives an error. +func (client FactoriesClient) GetDataPlaneAccessSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetDataPlaneAccessResponder handles the response to the GetDataPlaneAccess request. The method always +// closes the http.Response Body. +func (client FactoriesClient) GetDataPlaneAccessResponder(resp *http.Response) (result AccessPolicyResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // GetGitHubAccessToken get GitHub Access Token. // Parameters: // resourceGroupName - the resource group name. diff --git a/services/datafactory/mgmt/2018-06-01/datafactory/models.go b/services/datafactory/mgmt/2018-06-01/datafactory/models.go index 62424ba4408a..ce45657147c3 100644 --- a/services/datafactory/mgmt/2018-06-01/datafactory/models.go +++ b/services/datafactory/mgmt/2018-06-01/datafactory/models.go @@ -1806,6 +1806,17 @@ func PossibleWebActivityMethodValues() []WebActivityMethod { return []WebActivityMethod{DELETE, GET, POST, PUT} } +// AccessPolicyResponse get Data Plane read only token response definition. +type AccessPolicyResponse struct { + autorest.Response `json:"-"` + // Policy - The user access policy. + Policy *UserAccessPolicy `json:"policy,omitempty"` + // AccessToken - Data Plane read only access token. + AccessToken *string `json:"accessToken,omitempty"` + // DataPlaneURL - Data Plane service base URL. + DataPlaneURL *string `json:"dataPlaneUrl,omitempty"` +} + // BasicActivity a pipeline activity. type BasicActivity interface { AsDatabricksSparkPythonActivity() (*DatabricksSparkPythonActivity, bool) @@ -105119,6 +105130,20 @@ type UpdateIntegrationRuntimeRequest struct { UpdateDelayOffset *string `json:"updateDelayOffset,omitempty"` } +// UserAccessPolicy get Data Plane read only token request definition. +type UserAccessPolicy struct { + // Permissions - The string with permissions for Data Plane access. Currently only 'r' is supported which grants read only access. + Permissions *string `json:"permissions,omitempty"` + // AccessResourcePath - The resource path to get access relative to factory. Currently only empty string is supported which corresponds to the factory resource. + AccessResourcePath *string `json:"accessResourcePath,omitempty"` + // ProfileName - The name of the profile. Currently only the default is supported. The default value is DefaultProfile. + ProfileName *string `json:"profileName,omitempty"` + // StartTime - Start time for the token. If not specified the current time will be used. + StartTime *string `json:"startTime,omitempty"` + // ExpireTime - Expiration time for the token. Maximum duration for the token is eight hours and by default the token will expire in eight hours. + ExpireTime *string `json:"expireTime,omitempty"` +} + // UserProperty user property. type UserProperty struct { // Name - User proprety name.