{"action":"opened","issue":{"url":"https://api.github.com/repos/Azure/azure-sdk-for-media-services-extensions/issues/21","labels_url":"https://api.github.com/repos/Azure/azure-sdk-for-media-services-extensions/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-sdk-for-media-services-extensions/issues/21/comments","events_url":"https://api.github.com/repos/Azure/azure-sdk-for-media-services-extensions/issues/21/events","html_url":"https://github.com/Azure/azure-sdk-for-media-services-extensions/issues/21","id":104160154,"number":21,"title":"LocatorBae","user":{"login":"AlexBoYang","id":6786119,"avatar_url":"https://avatars.githubusercontent.com/u/6786119?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexBoYang","html_url":"https://github.com/AlexBoYang","followers_url":"https://api.github.com/users/AlexBoYang/followers","following_url":"https://api.github.com/users/AlexBoYang/following{/other_user}","gists_url":"https://api.github.com/users/AlexBoYang/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexBoYang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexBoYang/subscriptions","organizations_url":"https://api.github.com/users/AlexBoYang/orgs","repos_url":"https://api.github.com/users/AlexBoYang/repos","events_url":"https://api.github.com/users/AlexBoYang/events{/privacy}","received_events_url":"https://api.github.com/users/AlexBoYang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-01T00:38:05Z","updated_at":"2015-09-01T00:38:05Z","closed_at":null,"body":"LocatorBaseCollectionExtension CreateAsync method will generate policy object per asset:\r\n\r\npublic static async Task<ILocator> CreateAsync(this LocatorBaseCollection locators, LocatorType locatorType, IAsset asset, AccessPermissions permissions, TimeSpan duration, DateTime? startTime)\r\n        {\r\n            if (locators == null)\r\n            {\r\n                throw new ArgumentNullException(\"locators\", \"The locators collection cannot be null.\");\r\n            }\r\n\r\n            if (asset == null)\r\n            {\r\n                throw new ArgumentNullException(\"asset\", \"The asset cannot be null.\");\r\n            }\r\n\r\n            MediaContextBase context = locators.MediaContext;\r\n\r\n            var policy = await context.AccessPolicies.CreateAsync(asset.Name, duration, permissions).ConfigureAwait(false); <<-- Will generate a new policy per asset\r\n\r\n            return await locators.CreateLocatorAsync(locatorType, asset, policy, startTime).ConfigureAwait(false);\r\n        }\r\n"}}