Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into expose_parse_vault_id

* 'master' of https://github.com/Azure/azure-sdk-for-python: (37 commits)
  [text analytics] add versionadded sphinx documentation (Azure#13450)
  [text analytics] add bing_id property to LinkedEntity class (Azure#13446)
  fix typing for paging methods (Azure#13410)
  [text analytics] add domain_filter param (Azure#13451)
  fix issue Azure#11658 for is_valid_resource_id (Azure#11709)
  added create_table_if_not_exists method to table service client (Azure#13385)
  [ServiceBus] Test and failure improvements (Azure#13345)
  Proper encoding and decoding of source URLs - Fixes special characters in source URL issue (Azure#13275)
  Switch retry (Azure#13264)
  [ServiceBus] ServiceBusClient close spawned children (Azure#13077)
  fixing version issue by not overwriting the version with the semantic… (Azure#13411)
  clean up reference and tests (Azure#13412)
  Consistent returns (Azure#13245)
  [text analytics] return None for offset and length for v3.0 (Azure#13382)
  edit all authentication files and add a test (Azure#13355)
  Add managed_identity_client_id argument to DefaultAzureCredential (Azure#13218)
  [text analytics] add string-index-type support (Azure#13378)
  [text analytics] fix error response if pii entities is called from v3.0 client (Azure#13383)
  Send spec (Azure#13143)
  Anomaly Detector 3.0.0b2 release (Azure#13351)
  ...
  • Loading branch information
iscai-msft committed Sep 1, 2020
2 parents 1a5c23b + 537dd08 commit 05be0b7
Show file tree
Hide file tree
Showing 1,083 changed files with 47,002 additions and 12,241 deletions.
5 changes: 3 additions & 2 deletions eng/common/pipelines/templates/steps/create-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ parameters:
PushArgs:
WorkingDirectory: $(System.DefaultWorkingDirectory)
PRTitle: not-specified
PRBody: not-specified
PRBody: ''
ScriptDirectory: eng/common/scripts
GHReviewersVariable: ''
GHTeamReviewersVariable: ''
Expand Down Expand Up @@ -68,12 +68,13 @@ steps:
-PRBranch "${{ parameters.PRBranchName }}"
-AuthToken "$(azuresdk-github-pat)"
-PRTitle "${{ parameters.PRTitle }}"
-PRBody "${{ coalesce(parameters.PRBody, parameters.CommitMsg, parameters.PRTitle) }}"
-PRLabels "${{ parameters.PRLabels}}"
-PRBody "${{ parameters.PRBody }}"
- task: PowerShell@2
displayName: Tag a Reviewer on PR
condition: and(succeeded(), eq(variables['HasChanges'], 'true'))
continueOnError: true
inputs:
pwsh: true
workingDirectory: ${{ parameters.WorkingDirectory }}
Expand Down
16 changes: 12 additions & 4 deletions eng/common/pipelines/templates/steps/get-pr-owners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,20 @@ steps:
--kusto-database-var KUSTO_DB `
--kusto-table-var KUSTO_TABLE `
--identity "$(Build.QueuedBy)"
$resolvedIdentity = $result[-1] | ConvertFrom-Json
Write-Host $resolvedIdentity
$resolvedIdentity = ""
try { $resolvedIdentity = $result[-1] | ConvertFrom-Json } catch {}
Write-Output "##vso[task.setvariable variable=${{ parameters.TargetVariable }}]$($resolvedIdentity.GithubUserName)"
if($resolvedIdentity) {
Write-Host $resolvedIdentity
Write-Host "##vso[task.setvariable variable=${{ parameters.TargetVariable }}]$($resolvedIdentity.GithubUserName)"
}
else {
Write-Host "Unable to locate a github user for identity $(Build.QueuedBy)"
}
displayName: 'Resolving Queuing User'
continueOnError: true
workingDirectory: $(Build.SourcesDirectory)/tools_repo/tools/notification-configuration/identity-resolver
env:
APP_ID: $(notification-aad-app-id)
Expand All @@ -41,6 +49,6 @@ steps:
$originalValue = "$(${{ parameters.TargetVariable }})"
$result = $(Build.SourcesDirectory)/eng/common/scripts/get-codeowners.ps1 -TargetDirectory /sdk/${{ parameters.ServiceDirectory }}/ -RootDirectory $(Build.SourcesDirectory)
if ($result) {
Write-Output "##vso[task.setvariable variable=${{ parameters.TargetVariable }}]$originalValue,$result"
Write-Host "##vso[task.setvariable variable=${{ parameters.TargetVariable }}]$originalValue,$result"
}
displayName: Add CodeOwners if Present
6 changes: 5 additions & 1 deletion eng/common/scripts/Submit-PullRequest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ The branch which we want to create a pull request for.
A personal access token
.PARAMETER PRTitle
The title of the pull request.
.PARAMETER PRBody
The body message for the pull request.
.PARAMETER PRLabels
The labels added to the PRs. Multple labels seperated by comma, e.g "bug, service"
#>
Expand All @@ -42,7 +44,9 @@ param(

[Parameter(Mandatory = $true)]
[string]$PRTitle,
$PRBody = $PRTitle,

[Parameter(Mandatory = $false)]
[string]$PRBody = $PRTitle,

[Parameter(Mandatory = $false)]
[string]$PRLabels
Expand Down
77 changes: 29 additions & 48 deletions eng/common/scripts/add-pullrequest-reviewers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,32 @@ param(
$AuthToken
)

function AddMembers($memberName, $additionSet) {
$headers = @{
Authorization = "bearer $AuthToken"
}
$uri = "https://api.github.com/repos/$RepoOwner/$RepoName/pulls/$PRNumber/requested_reviewers"
$errorOccurred = $false

foreach ($id in $additionSet) {
try {
$postResp = @{}
$postResp[$memberName] = @($id)
$postResp = $postResp | ConvertTo-Json

Write-Host $postResp
$resp = Invoke-RestMethod -Method Post -Headers $headers -Body $postResp -Uri $uri -MaximumRetryCount 3
$resp | Write-Verbose
}
catch {
Write-Host "Error attempting to add $user `n$_"
$errorOccurred = $true
}
}

return $errorOccurred
}

# at least one of these needs to be populated
if (-not $GitHubUsers -and -not $GitHubTeams) {
Write-Host "No user provided for addition, exiting."
Expand All @@ -27,54 +53,9 @@ if (-not $GitHubUsers -and -not $GitHubTeams) {
$userAdditions = @($GitHubUsers.Split(",") | % { $_.Trim() } | ? { return $_ })
$teamAdditions = @($GitHubTeams.Split(",") | % { $_.Trim() } | ? { return $_ })

$headers = @{
Authorization = "bearer $AuthToken"
}
$uri = "https://api.github.com/repos/$RepoOwner/$RepoName/pulls/$PRNumber/requested_reviewers"
$errorsOccurredAddingUsers = AddMembers -memberName "reviewers" -additionSet $userAdditions
$errorsOccurredAddingTeams = AddMembers -memberName "team_reviewers" -additionSet $teamAdditions

try {
$resp = Invoke-RestMethod -Headers $headers $uri -MaximumRetryCount 3
}
catch {
Write-Error "Invoke-RestMethod [$uri] failed with exception:`n$_"
if ($errorsOccurredAddingUsers -or $errorsOccurredAddingTeams) {
exit 1
}

# the response object takes this form: https://developer.github.com/v3/pulls/review_requests/#response-1
# before we can push a new reviewer, we need to pull the simple Ids out of the complex objects that came back in the response
$userReviewers = @($resp.users | % { return $_.login })
$teamReviewers = @($resp.teams | % { return $_.slug })

if (!$userReviewers) { $modifiedUserReviewers = @() } else { $modifiedUserReviewers = $userReviewers.Clone() }
$modifiedUserReviewers += ($userAdditions | ? { !$modifiedUserReviewers.Contains($_) })

if ($teamReviewers) { $modifiedTeamReviewers = @() } else { $modifiedTeamReviewers = $teamReviewers.Clone() }
$modifiedTeamReviewers += ($teamAdditions | ? { !$modifiedTeamReviewers.Contains($_) })

$detectedUserDiffs = Compare-Object -ReferenceObject $userReviewers -DifferenceObject $modifiedUserReviewers
$detectedTeamDiffs = Compare-Object -ReferenceObject $teamReviewers -DifferenceObject $modifiedTeamReviewers

# Compare-Object returns values when there is a difference between the comparied objects.
# we only want to run the update if there IS a difference.
if ($detectedUserDiffs -or $detectedTeamDiffs) {
$postResp = @{}

if ($modifiedUserReviewers) { $postResp["reviewers"] = $modifiedUserReviewers }
if ($modifiedTeamReviewers) { $postResp["team_reviewers"] = $modifiedTeamReviewers }

$postResp = $postResp | ConvertTo-Json

try {
Write-Host $postResp
$resp = Invoke-RestMethod -Method Post -Headers $headers -Body $postResp -Uri $uri -MaximumRetryCount 3
$resp | Write-Verbose
}
catch {
Write-Error "Unable to update PR reviewers. `n$_"
}
}
else {
$results = $GitHubUsers + $GitHubTeams
Write-Host "Reviewers $results already added. Exiting."
exit(0)
}
15 changes: 14 additions & 1 deletion sdk/anomalydetector/azure-ai-anomalydetector/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# Release History

## 3.0.0b2 (Unreleased)
## 3.0.0b2 (2020-08-27)

**Bug Fixes**
- Fixed an issue with ChangePointDetect

**Breaking Changes**
- Renamed `entire_detect` to `detect_entire_series`
- Renamed `APIError` to `AnomalyDetectorError`
- Renamed `Request` to `DetectRequest`
- Renamed `LastDetect` to `DetectLastPoint`
- Renamed `ChangePointDetect` to `DetectChangePoint`
- Renamed `Granularity` to `TimeGranularity`
- Renamed `minutely` and `secondly` to `per_minute` and `per_second`
- Renamed `Point` to `TimeSeriesPoint`


## 3.0.0b1 (2020-08-17)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

class AnomalyDetectorClientOperationsMixin:

async def entire_detect(
async def detect_entire_series(
self,
body: "models.Request",
body: "models.DetectRequest",
**kwargs
) -> "models.EntireDetectResponse":
"""Detect anomalies for the entire series in batch.
Expand All @@ -32,7 +32,7 @@ async def entire_detect(
:param body: Time series points and period if needed. Advanced model parameters can also be set
in the request.
:type body: ~azure.ai.anomalydetector.models.Request
:type body: ~azure.ai.anomalydetector.models.DetectRequest
:keyword callable cls: A custom type or function that will be passed the direct response
:return: EntireDetectResponse, or the result of cls(response)
:rtype: ~azure.ai.anomalydetector.models.EntireDetectResponse
Expand All @@ -44,7 +44,7 @@ async def entire_detect(
content_type = kwargs.pop("content_type", "application/json")

# Construct URL
url = self.entire_detect.metadata['url'] # type: ignore
url = self.detect_entire_series.metadata['url'] # type: ignore
path_format_arguments = {
'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
}
Expand All @@ -59,7 +59,7 @@ async def entire_detect(
header_parameters['Accept'] = 'application/json'

body_content_kwargs = {} # type: Dict[str, Any]
body_content = self._serialize.body(body, 'Request')
body_content = self._serialize.body(body, 'DetectRequest')
body_content_kwargs['content'] = body_content
request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)

Expand All @@ -68,7 +68,7 @@ async def entire_detect(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize(models.APIError, response)
error = self._deserialize(models.AnomalyDetectorError, response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('EntireDetectResponse', pipeline_response)
Expand All @@ -77,11 +77,11 @@ async def entire_detect(
return cls(pipeline_response, deserialized, {})

return deserialized
entire_detect.metadata = {'url': '/timeseries/entire/detect'} # type: ignore
detect_entire_series.metadata = {'url': '/timeseries/entire/detect'} # type: ignore

async def last_detect(
async def detect_last_point(
self,
body: "models.Request",
body: "models.DetectRequest",
**kwargs
) -> "models.LastDetectResponse":
"""Detect anomaly status of the latest point in time series.
Expand All @@ -92,7 +92,7 @@ async def last_detect(
:param body: Time series points and period if needed. Advanced model parameters can also be set
in the request.
:type body: ~azure.ai.anomalydetector.models.Request
:type body: ~azure.ai.anomalydetector.models.DetectRequest
:keyword callable cls: A custom type or function that will be passed the direct response
:return: LastDetectResponse, or the result of cls(response)
:rtype: ~azure.ai.anomalydetector.models.LastDetectResponse
Expand All @@ -104,7 +104,7 @@ async def last_detect(
content_type = kwargs.pop("content_type", "application/json")

# Construct URL
url = self.last_detect.metadata['url'] # type: ignore
url = self.detect_last_point.metadata['url'] # type: ignore
path_format_arguments = {
'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
}
Expand All @@ -119,7 +119,7 @@ async def last_detect(
header_parameters['Accept'] = 'application/json'

body_content_kwargs = {} # type: Dict[str, Any]
body_content = self._serialize.body(body, 'Request')
body_content = self._serialize.body(body, 'DetectRequest')
body_content_kwargs['content'] = body_content
request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)

Expand All @@ -128,7 +128,7 @@ async def last_detect(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize(models.APIError, response)
error = self._deserialize(models.AnomalyDetectorError, response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('LastDetectResponse', pipeline_response)
Expand All @@ -137,9 +137,9 @@ async def last_detect(
return cls(pipeline_response, deserialized, {})

return deserialized
last_detect.metadata = {'url': '/timeseries/last/detect'} # type: ignore
detect_last_point.metadata = {'url': '/timeseries/last/detect'} # type: ignore

async def change_point_detect(
async def detect_change_point(
self,
body: "models.ChangePointDetectRequest",
**kwargs
Expand All @@ -162,7 +162,7 @@ async def change_point_detect(
content_type = kwargs.pop("content_type", "application/json")

# Construct URL
url = self.change_point_detect.metadata['url'] # type: ignore
url = self.detect_change_point.metadata['url'] # type: ignore
path_format_arguments = {
'Endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
}
Expand All @@ -186,7 +186,7 @@ async def change_point_detect(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize(models.APIError, response)
error = self._deserialize(models.AnomalyDetectorError, response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize('ChangePointDetectResponse', pipeline_response)
Expand All @@ -195,4 +195,4 @@ async def change_point_detect(
return cls(pipeline_response, deserialized, {})

return deserialized
change_point_detect.metadata = {'url': '/timeseries/changePoint/detect'} # type: ignore
detect_change_point.metadata = {'url': '/timeseries/changepoint/detect'} # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,35 @@
# --------------------------------------------------------------------------

try:
from ._models_py3 import APIError
from ._models_py3 import AnomalyDetectorError
from ._models_py3 import ChangePointDetectRequest
from ._models_py3 import ChangePointDetectResponse
from ._models_py3 import DetectRequest
from ._models_py3 import EntireDetectResponse
from ._models_py3 import LastDetectResponse
from ._models_py3 import Point
from ._models_py3 import Request
from ._models_py3 import TimeSeriesPoint
except (SyntaxError, ImportError):
from ._models import APIError # type: ignore
from ._models import AnomalyDetectorError # type: ignore
from ._models import ChangePointDetectRequest # type: ignore
from ._models import ChangePointDetectResponse # type: ignore
from ._models import DetectRequest # type: ignore
from ._models import EntireDetectResponse # type: ignore
from ._models import LastDetectResponse # type: ignore
from ._models import Point # type: ignore
from ._models import Request # type: ignore
from ._models import TimeSeriesPoint # type: ignore

from ._anomaly_detector_client_enums import (
AnomalyDetectorErrorCodes,
Granularity,
TimeGranularity,
)

__all__ = [
'APIError',
'AnomalyDetectorError',
'ChangePointDetectRequest',
'ChangePointDetectResponse',
'DetectRequest',
'EntireDetectResponse',
'LastDetectResponse',
'Point',
'Request',
'TimeSeriesPoint',
'AnomalyDetectorErrorCodes',
'Granularity',
'TimeGranularity',
]
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AnomalyDetectorErrorCodes(with_metaclass(_CaseInsensitiveEnumMeta, str, En
REQUIRED_GRANULARITY = "RequiredGranularity"
REQUIRED_SERIES = "RequiredSeries"

class Granularity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
class TimeGranularity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
"""Can only be one of yearly, monthly, weekly, daily, hourly, minutely or secondly. Granularity is
used for verify whether input series is valid.
"""
Expand All @@ -50,5 +50,5 @@ class Granularity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
WEEKLY = "weekly"
DAILY = "daily"
HOURLY = "hourly"
MINUTELY = "minutely"
SECONDLY = "secondly"
PER_MINUTE = "minutely"
PER_SECOND = "secondly"
Loading

0 comments on commit 05be0b7

Please sign in to comment.