示例#1
0
 public Schema GetSchema(string customerID, string schemaName)
 {
     using (PoolItem <DirectoryService> connection = this.directoryServicePool.Take(NullValueHandling.Ignore))
     {
         SchemasResource.GetRequest schemaReq = connection.Item.Schemas.Get(customerID, schemaName);
         return(schemaReq.ExecuteWithRetryOnBackoff());
     }
 }
示例#2
0
 public bool HasSchema(string customerID, string schemaName)
 {
     try
     {
         using (PoolItem <DirectoryService> connection = this.directoryServicePool.Take(NullValueHandling.Ignore))
         {
             SchemasResource.GetRequest schemaReq = connection.Item.Schemas.Get(customerID, schemaName);
             Schema schema = schemaReq.ExecuteWithRetryOnBackoff();
             if (schema != null)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     catch (Google.GoogleApiException ex)
     {
         if (ex.HttpStatusCode == System.Net.HttpStatusCode.NotFound || ex.HttpStatusCode == System.Net.HttpStatusCode.Forbidden)
         {
             return(false);
         }
         else
         {
             throw;
         }
     }
     catch (TokenResponseException ex)
     {
         if (ex.StatusCode == System.Net.HttpStatusCode.Forbidden || ex.StatusCode == System.Net.HttpStatusCode.Unauthorized)
         {
             return(false);
         }
         else
         {
             throw;
         }
     }
 }