コード例 #1
0
        public void ConstructFromDomain()
        {
            Uri expected = new Uri("https://sts.eastus2.mixedreality.com");
            Uri actual   = AuthenticationEndpoint.ConstructFromDomain("eastus2.mixedreality.com");

            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void ConstructFromDomainWithInvalidParameters()
        {
            ArgumentException?ex = Assert.Throws <ArgumentNullException>(() => AuthenticationEndpoint.ConstructFromDomain(null !));

            Assert.AreEqual("accountDomain", ex !.ParamName);

            ex = Assert.Throws <ArgumentException>(() => AuthenticationEndpoint.ConstructFromDomain(string.Empty));
            Assert.AreEqual("accountDomain", ex !.ParamName);

            ex = Assert.Throws <ArgumentException>(() => AuthenticationEndpoint.ConstructFromDomain(" "));
            Assert.AreEqual("accountDomain", ex !.ParamName);
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RemoteRenderingClient" /> class.
        /// </summary>
        /// <param name="remoteRenderingEndpoint">The rendering service endpoint. This determines the region in which the rendering VM is created.</param>
        /// <param name="accountId">The Azure Remote Rendering account identifier.</param>
        /// <param name="accountDomain">The Azure Remote Rendering account domain.</param>
        /// <param name="credential">The credential used to access the Mixed Reality service.</param>
        /// <param name="options">The options.</param>
        public RemoteRenderingClient(Uri remoteRenderingEndpoint, Guid accountId, string accountDomain, TokenCredential credential, RemoteRenderingClientOptions options = null)
        {
            Argument.AssertNotDefault(ref accountId, nameof(accountId));
            Argument.AssertNotNullOrWhiteSpace(accountDomain, nameof(accountDomain));
            Argument.AssertNotNull(credential, nameof(credential));

            options ??= new RemoteRenderingClientOptions();

            Uri             authenticationEndpoint = options.AuthenticationEndpoint ?? AuthenticationEndpoint.ConstructFromDomain(accountDomain);
            TokenCredential mrTokenCredential      = MixedRealityTokenCredential.GetMixedRealityCredential(accountId, authenticationEndpoint, credential);

            _accountId         = accountId;
            _clientDiagnostics = new ClientDiagnostics(options);
            _pipeline          = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(mrTokenCredential, GetDefaultScope(remoteRenderingEndpoint)));
            _restClient        = new RemoteRenderingRestClient(_clientDiagnostics, _pipeline, remoteRenderingEndpoint.ToString(), options.Version);
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ObjectAnchorsConversionClient" /> class.
        /// </summary>
        /// <param name="accountId">The Azure Object Anchors account ID.</param>
        /// <param name="accountDomain">The Azure Object Anchors account domain.</param>
        /// <param name="credential">The credential used to access the Mixed Reality service.</param>
        /// <param name="options">The options.</param>
        public ObjectAnchorsConversionClient(Guid accountId, string accountDomain, TokenCredential credential, ObjectAnchorsConversionClientOptions options = null)
        {
            Argument.AssertNotDefault(ref accountId, nameof(accountId));
            Argument.AssertNotNullOrWhiteSpace(accountDomain, nameof(accountDomain));
            Argument.AssertNotNull(credential, nameof(credential));

            options = options ?? new ObjectAnchorsConversionClientOptions();
            Uri             authenticationEndpoint = options.MixedRealityAuthenticationEndpoint ?? AuthenticationEndpoint.ConstructFromDomain(accountDomain);
            TokenCredential mrTokenCredential      = MixedRealityTokenCredential.GetMixedRealityCredential(accountId, authenticationEndpoint, credential, options.MixedRealityAuthenticationOptions);
            Uri             serviceEndpoint        = options.ServiceEndpoint ?? ConstructObjectAnchorsEndpointUrl(accountDomain);

            AccountId = accountId;
            SupportedAssetFileTypesSet = options.SupportedAssetFileTypes;
            _clientDiagnostics         = new ClientDiagnostics(options);
            _pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(mrTokenCredential, GetDefaultScope(serviceEndpoint)));
            _getBlobUploadEndpointRestClient = new BlobUploadEndpointRestClient(_clientDiagnostics, _pipeline, serviceEndpoint, options.Version);
            _ingestionJobRestClient          = new IngestionJobRestClient(_clientDiagnostics, _pipeline, serviceEndpoint, options.Version);
        }